diff --git a/NAMESPACE b/NAMESPACE index 2addce64..bf80f273 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -266,10 +266,13 @@ export(stat_slabinterval) export(stat_spike) export(subguide_axis) export(subguide_count) +export(subguide_dots) export(subguide_inside) export(subguide_integer) export(subguide_none) export(subguide_outside) +export(subguide_slab) +export(subguide_spike) export(subscale_identity) export(subscale_thickness) export(theme_ggdist) diff --git a/NEWS.md b/NEWS.md index 94eddfac..1e621697 100755 --- a/NEWS.md +++ b/NEWS.md @@ -10,6 +10,9 @@ New features and enhancements: * More arguments to `stat_slabinterval()` now use `waiver()`s so that they can be set either in the call to the stat or in the call to the density estimator (#220). +* Default subscales and subguides can be set by assigning `subscale_thickness`, + `subguide_slab`, `subguide_dots`, and `subguide_spike` in the global + environment (#225). Bug fixes: diff --git a/R/geom_dotsinterval.R b/R/geom_dotsinterval.R index 8d869042..a53514b6 100755 --- a/R/geom_dotsinterval.R +++ b/R/geom_dotsinterval.R @@ -12,7 +12,7 @@ dots_grob = function(data, x, y, xscale = 1, name = NULL, gp = gpar(), vp = NULL, dotsize = 1.07, stackratio = 1, binwidth = NA, layout = "bin", overlaps = "nudge", overflow = "warn", - subguide = "none", + subguide = "dots", verbose = FALSE, orientation = "vertical", make_points_grob = make_points_grob diff --git a/R/geom_slabinterval.R b/R/geom_slabinterval.R index 9b48b828..463fec1c 100755 --- a/R/geom_slabinterval.R +++ b/R/geom_slabinterval.R @@ -173,11 +173,11 @@ draw_slabs = function( } }) - subguide_grobs = if (identical(subguide, "none")) { + subguide_fun = match_function(subguide, "subguide_") + subguide_grobs = if (identical(subguide_fun(numeric()), zeroGrob())) { # quick exit, also avoid errors for multiple non-equal axes when not drawing them list() } else { - subguide_fun = match_function(subguide, "subguide_") subguide_params = coord$transform(subguide_params, panel_params) dlply_(subguide_params, c(y, "side", "justification", "scale"), function(d) { d$group = NULL @@ -601,7 +601,10 @@ GeomSlabinterval = ggproto("GeomSlabinterval", AbstractGeom, of values to be scaled and then returns a [thickness] vector representing the scaled values, such as [subscale_thickness()] or [subscale_identity()]. \\item A string giving the name of such a function when prefixed - with `"subscale_"`; e.g. `"thickness"` or `"identity"`. + with `"subscale_"`; e.g. `"thickness"` or `"identity"`. The value + `"thickness"` using the default subscale, which can be modified by + setting [`subguide_thickness`]; see the documentation for that + function. } For a comprehensive discussion and examples of slab scaling and normalization, see the [`thickness` scale article](https://mjskay.github.io/ggdist/articles/thickness.html). @@ -684,7 +687,11 @@ GeomSlabinterval = ggproto("GeomSlabinterval", AbstractGeom, [subguide_none()] (to draw no annotation). See [subguide_axis()] for a list of possibilities and examples. \\item A string giving the name of such a function when prefixed - with `"subguide_"`; e.g. `"axis"` or `"none"`. + with `"subguide_"`; e.g. `"axis"` or `"none"`. The values `"slab"`, + `"dots"`, and `"spike"` use the default subguide for their geom + families (no subguide), which can be modified by setting + [`subguide_slab`], [`subguide_dots`], or [`subguide_spike`]; + see the documentation for those functions. } ') ), AbstractGeom$param_docs), @@ -701,7 +708,7 @@ GeomSlabinterval = ggproto("GeomSlabinterval", AbstractGeom, show_slab = TRUE, show_point = TRUE, show_interval = TRUE, - subguide = "none", + subguide = "slab", na.rm = FALSE ), diff --git a/R/geom_spike.R b/R/geom_spike.R index 4d37c41b..8068bff4 100755 --- a/R/geom_spike.R +++ b/R/geom_spike.R @@ -170,6 +170,10 @@ GeomSpike = ggproto("GeomSpike", GeomSlab, arrow = '[grid::arrow()] giving the arrow heads to use on the spike, or `NULL` for no arrows.' ), GeomSlab$param_docs), + default_params = defaults(list( + subguide = "spike" + ), GeomSlab$default_params), + hidden_params = setdiff( union("fill_type", GeomSlab$hidden_params), "arrow" diff --git a/R/subguide.R b/R/subguide.R index 1c63d328..a6f07c86 100755 --- a/R/subguide.R +++ b/R/subguide.R @@ -1,8 +1,8 @@ #' Axis sub-guide for thickness scales #' -#' This is a sub-guide intended for annotating the `thickness` aesthetic -#' in \pkg{ggdist}. It can be used with the `subguide` parameter of -#' [geom_slabinterval()]. +#' This is a sub-guide intended for annotating the `thickness` and dot-count +#' subscales in \pkg{ggdist}. It can be used with the `subguide` parameter of +#' [geom_slabinterval()] and [geom_dotsinterval()]. #' @template description-auto-partial-waivable #' #' @inheritParams scale_thickness @@ -93,7 +93,7 @@ subguide_axis = auto_partial(name = "subguide_axis", function( grob_width = switch(width., width = grobWidth, height = grobHeight) position = get_subguide_position(position, orientation) - limits = range(values) + limits = suppressWarnings(range(values)) scale = scale_thickness_shared(breaks = breaks, labels = labels, limits = limits) scale$train(values) @@ -192,16 +192,42 @@ subguide_count = function(..., breaks = scales::breaks_width(1)) { #' Empty sub-guide for thickness scales #' -#' This is a blank sub-guide that omits annotations for the `thickness` aesthetic -#' in \pkg{ggdist}. It can be used with the `subguide` parameter of -#' [geom_slabinterval()]. +#' This is a blank sub-guide that omits annotations for the `thickness` and +#' dot-count sub-scales in \pkg{ggdist}. It can be used with the `subguide` +#' parameter of [geom_slabinterval()] and [geom_dotsinterval()]. +#' @template description-auto-partial-waivable #' #' @param ... ignored. #' @family sub-guides #' @export -subguide_none = function(...) { +subguide_none = auto_partial(name = "subguide_none", function(values, ...) { zeroGrob() -} +}) + +#' @details +#' [subguide_slab()], [subguide_dots()], and [subguide_spike()] are aliases +#' for [subguide_none()] that allow you to change the default subguide used +#' for the [geom_slabinterval()], [geom_dotsinterval()], and [geom_spike()] +#' families. If you overwrite these in the global environment, you can set +#' the corresponding default subguide. For example: +#' +#' ```r +#' subguide_slab = ggdist::subguide_inside(position = "right") +#' ``` +#' +#' This will cause [geom_slabinterval()]s to default to having a guide on the +#' right side of the geom. +#' @rdname subguide_axis +#' @export +subguide_slab = subguide_none + +#' @rdname subguide_axis +#' @export + +subguide_dots = subguide_none +#' @rdname subguide_axis +#' @export +subguide_spike = subguide_none # helpers ----------------------------------------------------------------- diff --git a/R/subscale.R b/R/subscale.R index 7b8f43ae..3c518914 100755 --- a/R/subscale.R +++ b/R/subscale.R @@ -15,6 +15,18 @@ #' - A function that accepts a length-2 [numeric] vector of the automatic #' limits and returns new limits. Unlike positional scales. Unlike #' positional scales, these limits will not remove data. +#' +#' @details +#' You can overwrite `subscale_thickness` in the global environment to set +#' the default properties of the thickness subscale. For example: +#' +#' ```r +#' subscale_thickness = ggdist::subscale_thickness(expand = expansion(c(0, 0.05))) +#' ``` +#' +#' This will cause [geom_slabinterval()]s to default to a thickness subscale +#' that expands by 5% at the top of the scale. **Always** prefix such a +#' definition with `ggdist::` to avoid infinite loops caused by recursion. #' @returns A [thickness] vector of the same length as `x` scaled to be between #' `0` and `1`. #' @family sub-scales diff --git a/man/geom_blur_dots.Rd b/man/geom_blur_dots.Rd index 64b227c1..90fa1f47 100755 --- a/man/geom_blur_dots.Rd +++ b/man/geom_blur_dots.Rd @@ -20,7 +20,7 @@ geom_blur_dots( overflow = "warn", verbose = FALSE, orientation = NA, - subguide = "none", + subguide = "slab", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE @@ -208,7 +208,11 @@ annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a tra \code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} for a list of possibilities and examples. \item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. }} \item{na.rm}{If \code{FALSE}, the default, missing values are removed with a warning. If \code{TRUE}, missing diff --git a/man/geom_dots.Rd b/man/geom_dots.Rd index 2df92d53..d0428b69 100755 --- a/man/geom_dots.Rd +++ b/man/geom_dots.Rd @@ -19,7 +19,7 @@ geom_dots( overflow = "warn", verbose = FALSE, orientation = NA, - subguide = "none", + subguide = "slab", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE @@ -196,7 +196,11 @@ annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a tra \code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} for a list of possibilities and examples. \item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. }} \item{na.rm}{If \code{FALSE}, the default, missing values are removed with a warning. If \code{TRUE}, missing diff --git a/man/geom_dotsinterval.Rd b/man/geom_dotsinterval.Rd index ed9139fc..8c1af112 100644 --- a/man/geom_dotsinterval.Rd +++ b/man/geom_dotsinterval.Rd @@ -26,7 +26,7 @@ geom_dotsinterval( show_slab = TRUE, show_point = TRUE, show_interval = TRUE, - subguide = "none", + subguide = "slab", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE @@ -231,7 +231,11 @@ annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a tra \code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} for a list of possibilities and examples. \item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. }} \item{na.rm}{If \code{FALSE}, the default, missing values are removed with a warning. If \code{TRUE}, missing diff --git a/man/geom_slab.Rd b/man/geom_slab.Rd index aee2a6c0..38a6a23a 100755 --- a/man/geom_slab.Rd +++ b/man/geom_slab.Rd @@ -14,7 +14,7 @@ geom_slab( subscale = "thickness", normalize = "all", fill_type = "segments", - subguide = "none", + subguide = "slab", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE @@ -76,7 +76,10 @@ the groups determined by \code{normalize}. One of: of values to be scaled and then returns a \link{thickness} vector representing the scaled values, such as \code{\link[=subscale_thickness]{subscale_thickness()}} or \code{\link[=subscale_identity]{subscale_identity()}}. \item A string giving the name of such a function when prefixed -with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. +with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. The value +\code{"thickness"} using the default subscale, which can be modified by +setting \code{\link{subguide_thickness}}; see the documentation for that +function. } For a comprehensive discussion and examples of slab scaling and normalization, see the \href{https://mjskay.github.io/ggdist/articles/thickness.html}{\code{thickness} scale article}.} @@ -123,7 +126,11 @@ annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a tra \code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} for a list of possibilities and examples. \item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. }} \item{na.rm}{If \code{FALSE}, the default, missing values are removed with a warning. If \code{TRUE}, missing diff --git a/man/geom_slabinterval.Rd b/man/geom_slabinterval.Rd index 98ba2bfe..6dd550c5 100644 --- a/man/geom_slabinterval.Rd +++ b/man/geom_slabinterval.Rd @@ -21,7 +21,7 @@ geom_slabinterval( show_slab = TRUE, show_point = TRUE, show_interval = TRUE, - subguide = "none", + subguide = "slab", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE @@ -83,7 +83,10 @@ the groups determined by \code{normalize}. One of: of values to be scaled and then returns a \link{thickness} vector representing the scaled values, such as \code{\link[=subscale_thickness]{subscale_thickness()}} or \code{\link[=subscale_identity]{subscale_identity()}}. \item A string giving the name of such a function when prefixed -with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. +with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. The value +\code{"thickness"} using the default subscale, which can be modified by +setting \code{\link{subguide_thickness}}; see the documentation for that +function. } For a comprehensive discussion and examples of slab scaling and normalization, see the \href{https://mjskay.github.io/ggdist/articles/thickness.html}{\code{thickness} scale article}.} @@ -158,7 +161,11 @@ annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a tra \code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} for a list of possibilities and examples. \item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. }} \item{na.rm}{If \code{FALSE}, the default, missing values are removed with a warning. If \code{TRUE}, missing diff --git a/man/geom_spike.Rd b/man/geom_spike.Rd index 997a2052..a8273f9d 100755 --- a/man/geom_spike.Rd +++ b/man/geom_spike.Rd @@ -10,11 +10,11 @@ geom_spike( stat = "identity", position = "identity", ..., + subguide = "spike", orientation = NA, subscale = "thickness", normalize = "all", arrow = NULL, - subguide = "none", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE @@ -54,6 +54,22 @@ you have overlapping geometries.} to a fixed value, like \code{colour = "red"} or \code{linewidth = 3} (see \strong{Aesthetics}, below). They may also be parameters to the paired geom/stat.} +\item{subguide}{Sub-guide used to annotate the \code{thickness} scale. One of: +\itemize{ +\item A function that takes a \code{scale} argument giving a \link[ggplot2:ggplot2-ggproto]{ggplot2::Scale} +object and an \code{orientation} argument giving the orientation of the +geometry and then returns a \link[grid:grid.grob]{grid::grob} that will draw the axis +annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a traditional axis) or +\code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} +for a list of possibilities and examples. +\item A string giving the name of such a function when prefixed +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. +}} + \item{orientation}{Whether this geom is drawn horizontally or vertically. One of: \itemize{ \item \code{NA} (default): automatically detect the orientation based on how the aesthetics @@ -76,7 +92,10 @@ the groups determined by \code{normalize}. One of: of values to be scaled and then returns a \link{thickness} vector representing the scaled values, such as \code{\link[=subscale_thickness]{subscale_thickness()}} or \code{\link[=subscale_identity]{subscale_identity()}}. \item A string giving the name of such a function when prefixed -with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. +with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. The value +\code{"thickness"} using the default subscale, which can be modified by +setting \code{\link{subguide_thickness}}; see the documentation for that +function. } For a comprehensive discussion and examples of slab scaling and normalization, see the \href{https://mjskay.github.io/ggdist/articles/thickness.html}{\code{thickness} scale article}.} @@ -97,18 +116,6 @@ For a comprehensive discussion and examples of slab scaling and normalization, s \item{arrow}{\code{\link[grid:arrow]{grid::arrow()}} giving the arrow heads to use on the spike, or \code{NULL} for no arrows.} -\item{subguide}{Sub-guide used to annotate the \code{thickness} scale. One of: -\itemize{ -\item A function that takes a \code{scale} argument giving a \link[ggplot2:ggplot2-ggproto]{ggplot2::Scale} -object and an \code{orientation} argument giving the orientation of the -geometry and then returns a \link[grid:grid.grob]{grid::grob} that will draw the axis -annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a traditional axis) or -\code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} -for a list of possibilities and examples. -\item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. -}} - \item{na.rm}{If \code{FALSE}, the default, missing values are removed with a warning. If \code{TRUE}, missing values are silently removed.} diff --git a/man/geom_swarm.Rd b/man/geom_swarm.Rd index 6796d42c..033d9dfc 100755 --- a/man/geom_swarm.Rd +++ b/man/geom_swarm.Rd @@ -19,7 +19,7 @@ geom_swarm( smooth = "none", verbose = FALSE, orientation = NA, - subguide = "none", + subguide = "slab", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE @@ -196,7 +196,11 @@ annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a tra \code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} for a list of possibilities and examples. \item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. }} \item{na.rm}{If \code{FALSE}, the default, missing values are removed with a warning. If \code{TRUE}, missing diff --git a/man/geom_weave.Rd b/man/geom_weave.Rd index 075a0340..9d259950 100755 --- a/man/geom_weave.Rd +++ b/man/geom_weave.Rd @@ -19,7 +19,7 @@ geom_weave( smooth = "none", verbose = FALSE, orientation = NA, - subguide = "none", + subguide = "slab", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE @@ -196,7 +196,11 @@ annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a tra \code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} for a list of possibilities and examples. \item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. }} \item{na.rm}{If \code{FALSE}, the default, missing values are removed with a warning. If \code{TRUE}, missing diff --git a/man/stat_ccdfinterval.Rd b/man/stat_ccdfinterval.Rd index a17d7cec..f8f38410 100755 --- a/man/stat_ccdfinterval.Rd +++ b/man/stat_ccdfinterval.Rd @@ -69,7 +69,10 @@ the groups determined by \code{normalize}. One of: of values to be scaled and then returns a \link{thickness} vector representing the scaled values, such as \code{\link[=subscale_thickness]{subscale_thickness()}} or \code{\link[=subscale_identity]{subscale_identity()}}. \item A string giving the name of such a function when prefixed -with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. +with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. The value +\code{"thickness"} using the default subscale, which can be modified by +setting \code{\link{subguide_thickness}}; see the documentation for that +function. } For a comprehensive discussion and examples of slab scaling and normalization, see the \href{https://mjskay.github.io/ggdist/articles/thickness.html}{\code{thickness} scale article}.} @@ -118,7 +121,11 @@ annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a tra \code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} for a list of possibilities and examples. \item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. }} }} diff --git a/man/stat_cdfinterval.Rd b/man/stat_cdfinterval.Rd index be531c3a..f4f56ed4 100755 --- a/man/stat_cdfinterval.Rd +++ b/man/stat_cdfinterval.Rd @@ -69,7 +69,10 @@ the groups determined by \code{normalize}. One of: of values to be scaled and then returns a \link{thickness} vector representing the scaled values, such as \code{\link[=subscale_thickness]{subscale_thickness()}} or \code{\link[=subscale_identity]{subscale_identity()}}. \item A string giving the name of such a function when prefixed -with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. +with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. The value +\code{"thickness"} using the default subscale, which can be modified by +setting \code{\link{subguide_thickness}}; see the documentation for that +function. } For a comprehensive discussion and examples of slab scaling and normalization, see the \href{https://mjskay.github.io/ggdist/articles/thickness.html}{\code{thickness} scale article}.} @@ -118,7 +121,11 @@ annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a tra \code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} for a list of possibilities and examples. \item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. }} }} diff --git a/man/stat_dots.Rd b/man/stat_dots.Rd index e2f152f2..20693263 100755 --- a/man/stat_dots.Rd +++ b/man/stat_dots.Rd @@ -165,7 +165,11 @@ annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a tra \code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} for a list of possibilities and examples. \item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. }} }} diff --git a/man/stat_dotsinterval.Rd b/man/stat_dotsinterval.Rd index ee1a8395..95abce4d 100755 --- a/man/stat_dotsinterval.Rd +++ b/man/stat_dotsinterval.Rd @@ -185,7 +185,11 @@ annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a tra \code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} for a list of possibilities and examples. \item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. }} }} diff --git a/man/stat_eye.Rd b/man/stat_eye.Rd index 8f3b87bd..ef0947b2 100755 --- a/man/stat_eye.Rd +++ b/man/stat_eye.Rd @@ -68,7 +68,10 @@ the groups determined by \code{normalize}. One of: of values to be scaled and then returns a \link{thickness} vector representing the scaled values, such as \code{\link[=subscale_thickness]{subscale_thickness()}} or \code{\link[=subscale_identity]{subscale_identity()}}. \item A string giving the name of such a function when prefixed -with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. +with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. The value +\code{"thickness"} using the default subscale, which can be modified by +setting \code{\link{subguide_thickness}}; see the documentation for that +function. } For a comprehensive discussion and examples of slab scaling and normalization, see the \href{https://mjskay.github.io/ggdist/articles/thickness.html}{\code{thickness} scale article}.} @@ -130,7 +133,11 @@ annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a tra \code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} for a list of possibilities and examples. \item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. }} }} diff --git a/man/stat_gradientinterval.Rd b/man/stat_gradientinterval.Rd index 0901023c..b85e6b9a 100755 --- a/man/stat_gradientinterval.Rd +++ b/man/stat_gradientinterval.Rd @@ -69,7 +69,10 @@ the groups determined by \code{normalize}. One of: of values to be scaled and then returns a \link{thickness} vector representing the scaled values, such as \code{\link[=subscale_thickness]{subscale_thickness()}} or \code{\link[=subscale_identity]{subscale_identity()}}. \item A string giving the name of such a function when prefixed -with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. +with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. The value +\code{"thickness"} using the default subscale, which can be modified by +setting \code{\link{subguide_thickness}}; see the documentation for that +function. } For a comprehensive discussion and examples of slab scaling and normalization, see the \href{https://mjskay.github.io/ggdist/articles/thickness.html}{\code{thickness} scale article}.} @@ -113,7 +116,11 @@ annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a tra \code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} for a list of possibilities and examples. \item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. }} }} diff --git a/man/stat_halfeye.Rd b/man/stat_halfeye.Rd index 717ee50e..54283a1a 100755 --- a/man/stat_halfeye.Rd +++ b/man/stat_halfeye.Rd @@ -68,7 +68,10 @@ the groups determined by \code{normalize}. One of: of values to be scaled and then returns a \link{thickness} vector representing the scaled values, such as \code{\link[=subscale_thickness]{subscale_thickness()}} or \code{\link[=subscale_identity]{subscale_identity()}}. \item A string giving the name of such a function when prefixed -with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. +with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. The value +\code{"thickness"} using the default subscale, which can be modified by +setting \code{\link{subguide_thickness}}; see the documentation for that +function. } For a comprehensive discussion and examples of slab scaling and normalization, see the \href{https://mjskay.github.io/ggdist/articles/thickness.html}{\code{thickness} scale article}.} @@ -130,7 +133,11 @@ annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a tra \code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} for a list of possibilities and examples. \item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. }} }} diff --git a/man/stat_histinterval.Rd b/man/stat_histinterval.Rd index d561ed35..aad636e3 100755 --- a/man/stat_histinterval.Rd +++ b/man/stat_histinterval.Rd @@ -68,7 +68,10 @@ the groups determined by \code{normalize}. One of: of values to be scaled and then returns a \link{thickness} vector representing the scaled values, such as \code{\link[=subscale_thickness]{subscale_thickness()}} or \code{\link[=subscale_identity]{subscale_identity()}}. \item A string giving the name of such a function when prefixed -with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. +with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. The value +\code{"thickness"} using the default subscale, which can be modified by +setting \code{\link{subguide_thickness}}; see the documentation for that +function. } For a comprehensive discussion and examples of slab scaling and normalization, see the \href{https://mjskay.github.io/ggdist/articles/thickness.html}{\code{thickness} scale article}.} @@ -130,7 +133,11 @@ annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a tra \code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} for a list of possibilities and examples. \item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. }} }} diff --git a/man/stat_mcse_dots.Rd b/man/stat_mcse_dots.Rd index d293ea38..0b91762c 100755 --- a/man/stat_mcse_dots.Rd +++ b/man/stat_mcse_dots.Rd @@ -175,7 +175,11 @@ annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a tra \code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} for a list of possibilities and examples. \item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. }} }} diff --git a/man/stat_slab.Rd b/man/stat_slab.Rd index f86e679d..e57a1a5d 100755 --- a/man/stat_slab.Rd +++ b/man/stat_slab.Rd @@ -66,7 +66,10 @@ the groups determined by \code{normalize}. One of: of values to be scaled and then returns a \link{thickness} vector representing the scaled values, such as \code{\link[=subscale_thickness]{subscale_thickness()}} or \code{\link[=subscale_identity]{subscale_identity()}}. \item A string giving the name of such a function when prefixed -with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. +with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. The value +\code{"thickness"} using the default subscale, which can be modified by +setting \code{\link{subguide_thickness}}; see the documentation for that +function. } For a comprehensive discussion and examples of slab scaling and normalization, see the \href{https://mjskay.github.io/ggdist/articles/thickness.html}{\code{thickness} scale article}.} @@ -110,7 +113,11 @@ annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a tra \code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} for a list of possibilities and examples. \item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. }} }} diff --git a/man/stat_slabinterval.Rd b/man/stat_slabinterval.Rd index 39bcc5c1..8ef00e3c 100755 --- a/man/stat_slabinterval.Rd +++ b/man/stat_slabinterval.Rd @@ -68,7 +68,10 @@ the groups determined by \code{normalize}. One of: of values to be scaled and then returns a \link{thickness} vector representing the scaled values, such as \code{\link[=subscale_thickness]{subscale_thickness()}} or \code{\link[=subscale_identity]{subscale_identity()}}. \item A string giving the name of such a function when prefixed -with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. +with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. The value +\code{"thickness"} using the default subscale, which can be modified by +setting \code{\link{subguide_thickness}}; see the documentation for that +function. } For a comprehensive discussion and examples of slab scaling and normalization, see the \href{https://mjskay.github.io/ggdist/articles/thickness.html}{\code{thickness} scale article}.} @@ -130,7 +133,11 @@ annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a tra \code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} for a list of possibilities and examples. \item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. }} }} diff --git a/man/stat_spike.Rd b/man/stat_spike.Rd index 6a2d9e4a..6d22da21 100755 --- a/man/stat_spike.Rd +++ b/man/stat_spike.Rd @@ -59,6 +59,21 @@ to a fixed value, like \code{colour = "red"} or \code{linewidth = 3} (see \stron parameters to the paired geom/stat. When paired with the default geom, \code{\link[=geom_spike]{geom_spike()}}, these include: \describe{ +\item{\code{subguide}}{Sub-guide used to annotate the \code{thickness} scale. One of: +\itemize{ +\item A function that takes a \code{scale} argument giving a \link[ggplot2:ggplot2-ggproto]{ggplot2::Scale} +object and an \code{orientation} argument giving the orientation of the +geometry and then returns a \link[grid:grid.grob]{grid::grob} that will draw the axis +annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a traditional axis) or +\code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} +for a list of possibilities and examples. +\item A string giving the name of such a function when prefixed +with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. The values \code{"slab"}, +\code{"dots"}, and \code{"spike"} use the default subguide for their geom +families (no subguide), which can be modified by setting +\code{\link{subguide_slab}}, \code{\link{subguide_dots}}, or \code{\link{subguide_spike}}; +see the documentation for those functions. +}} \item{\code{subscale}}{Sub-scale used to scale values of the \code{thickness} aesthetic within the groups determined by \code{normalize}. One of: \itemize{ @@ -66,7 +81,10 @@ the groups determined by \code{normalize}. One of: of values to be scaled and then returns a \link{thickness} vector representing the scaled values, such as \code{\link[=subscale_thickness]{subscale_thickness()}} or \code{\link[=subscale_identity]{subscale_identity()}}. \item A string giving the name of such a function when prefixed -with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. +with \code{"subscale_"}; e.g. \code{"thickness"} or \code{"identity"}. The value +\code{"thickness"} using the default subscale, which can be modified by +setting \code{\link{subguide_thickness}}; see the documentation for that +function. } For a comprehensive discussion and examples of slab scaling and normalization, see the \href{https://mjskay.github.io/ggdist/articles/thickness.html}{\code{thickness} scale article}.} @@ -84,17 +102,6 @@ only be used with functions whose values are in [0,1], such as CDFs). For a comprehensive discussion and examples of slab scaling and normalization, see the \href{https://mjskay.github.io/ggdist/articles/thickness.html}{\code{thickness} scale article}.} \item{\code{arrow}}{\code{\link[grid:arrow]{grid::arrow()}} giving the arrow heads to use on the spike, or \code{NULL} for no arrows.} -\item{\code{subguide}}{Sub-guide used to annotate the \code{thickness} scale. One of: -\itemize{ -\item A function that takes a \code{scale} argument giving a \link[ggplot2:ggplot2-ggproto]{ggplot2::Scale} -object and an \code{orientation} argument giving the orientation of the -geometry and then returns a \link[grid:grid.grob]{grid::grob} that will draw the axis -annotation, such as \code{\link[=subguide_axis]{subguide_axis()}} (to draw a traditional axis) or -\code{\link[=subguide_none]{subguide_none()}} (to draw no annotation). See \code{\link[=subguide_axis]{subguide_axis()}} -for a list of possibilities and examples. -\item A string giving the name of such a function when prefixed -with \code{"subguide_"}; e.g. \code{"axis"} or \code{"none"}. -}} }} \item{at}{The points at which to evaluate the PDF and CDF of the distribution. One of: diff --git a/man/subguide_axis.Rd b/man/subguide_axis.Rd index 559324d3..3030ff58 100755 --- a/man/subguide_axis.Rd +++ b/man/subguide_axis.Rd @@ -6,6 +6,9 @@ \alias{subguide_outside} \alias{subguide_integer} \alias{subguide_count} +\alias{subguide_slab} +\alias{subguide_dots} +\alias{subguide_spike} \title{Axis sub-guide for thickness scales} \usage{ subguide_axis( @@ -27,6 +30,12 @@ subguide_outside(..., label_side = "outside", just = 1) subguide_integer(..., breaks = scales::breaks_extended(Q = c(1, 5, 2, 4, 3))) subguide_count(..., breaks = scales::breaks_width(1)) + +subguide_slab(values, ...) + +subguide_dots(values, ...) + +subguide_spike(values, ...) } \arguments{ \item{values}{Values used to construct the scale used for this guide. @@ -95,9 +104,9 @@ settings that normally apply to axis guides will be followed.} \code{subguide_axis()} itself.} } \description{ -This is a sub-guide intended for annotating the \code{thickness} aesthetic -in \pkg{ggdist}. It can be used with the \code{subguide} parameter of -\code{\link[=geom_slabinterval]{geom_slabinterval()}}. +This is a sub-guide intended for annotating the \code{thickness} and dot-count +subscales in \pkg{ggdist}. It can be used with the \code{subguide} parameter of +\code{\link[=geom_slabinterval]{geom_slabinterval()}} and \code{\link[=geom_dotsinterval]{geom_dotsinterval()}}. Supports \link[=auto_partial]{automatic partial function application} with \link[=waiver]{waived arguments}. @@ -115,6 +124,18 @@ labeling counts in \code{\link[=geom_dots]{geom_dots()}}. \code{\link[=subguide_count]{subguide_count()}} is a shortcut for drawing labels where \emph{every} whole number is labeled, useful for labeling counts in \code{\link[=geom_dots]{geom_dots()}}. If your max count is large, \code{\link[=subguide_integer]{subguide_integer()}} may be better. + +\code{\link[=subguide_slab]{subguide_slab()}}, \code{\link[=subguide_dots]{subguide_dots()}}, and \code{\link[=subguide_spike]{subguide_spike()}} are aliases +for \code{\link[=subguide_none]{subguide_none()}} that allow you to change the default subguide used +for the \code{\link[=geom_slabinterval]{geom_slabinterval()}}, \code{\link[=geom_dotsinterval]{geom_dotsinterval()}}, and \code{\link[=geom_spike]{geom_spike()}} +families. If you overwrite these in the global environment, you can set +the corresponding default subguide. For example: + +\if{html}{\out{
}}\preformatted{subguide_slab = ggdist::subguide_inside(position = "right") +}\if{html}{\out{
}} + +This will cause \code{\link[=geom_slabinterval]{geom_slabinterval()}}s to default to having a guide on the +right side of the geom. } \examples{ library(ggplot2) diff --git a/man/subguide_none.Rd b/man/subguide_none.Rd index ab1f105d..79f765cb 100755 --- a/man/subguide_none.Rd +++ b/man/subguide_none.Rd @@ -4,15 +4,18 @@ \alias{subguide_none} \title{Empty sub-guide for thickness scales} \usage{ -subguide_none(...) +subguide_none(values, ...) } \arguments{ \item{...}{ignored.} } \description{ -This is a blank sub-guide that omits annotations for the \code{thickness} aesthetic -in \pkg{ggdist}. It can be used with the \code{subguide} parameter of -\code{\link[=geom_slabinterval]{geom_slabinterval()}}. +This is a blank sub-guide that omits annotations for the \code{thickness} and +dot-count sub-scales in \pkg{ggdist}. It can be used with the \code{subguide} +parameter of \code{\link[=geom_slabinterval]{geom_slabinterval()}} and \code{\link[=geom_dotsinterval]{geom_dotsinterval()}}. + +Supports \link[=auto_partial]{automatic partial function application} with +\link[=waiver]{waived arguments}. } \seealso{ Other sub-guides: diff --git a/man/subscale_thickness.Rd b/man/subscale_thickness.Rd index 0deb76bc..1da4b2a3 100755 --- a/man/subscale_thickness.Rd +++ b/man/subscale_thickness.Rd @@ -46,6 +46,17 @@ used with the \code{subscale} parameter of \code{\link[=geom_slabinterval]{geom_ Supports \link[=auto_partial]{automatic partial function application} with \link[=waiver]{waived arguments}. } +\details{ +You can overwrite \code{subscale_thickness} in the global environment to set +the default properties of the thickness subscale. For example: + +\if{html}{\out{
}}\preformatted{subscale_thickness = ggdist::subscale_thickness(expand = expansion(c(0, 0.05))) +}\if{html}{\out{
}} + +This will cause \code{\link[=geom_slabinterval]{geom_slabinterval()}}s to default to a thickness subscale +that expands by 5\% at the top of the scale. \strong{Always} prefix such a +definition with \verb{ggdist::} to avoid infinite loops caused by recursion. +} \examples{ library(ggplot2) library(distributional) diff --git a/tests/testthat/test.subguide.R b/tests/testthat/test.subguide.R index 0d63328f..4e024e13 100755 --- a/tests/testthat/test.subguide.R +++ b/tests/testthat/test.subguide.R @@ -226,6 +226,13 @@ test_that("dots subguide works with side and justification", { }) +# subguide_axis ----------------------------------------------------------- + +test_that("subguide_axis(numeric()) works but is not zeroGrob()", { + expect_false(identical(subguide_axis(numeric()), zeroGrob())) +}) + + # subguide_integer -------------------------------------------------------- test_that("integer subguide corner cases work", { @@ -253,7 +260,7 @@ test_that("integer subguide corner cases work", { # subguide_none ----------------------------------------------------------- test_that("subguide_none works", { - expect_identical(subguide_none(), zeroGrob()) + expect_identical(subguide_none(numeric()), zeroGrob()) })