From c25bb417cd3a1d7b8341ebcb90d4bc84d8806471 Mon Sep 17 00:00:00 2001 From: Matthew Kay Date: Tue, 2 Apr 2024 14:05:27 -0500 Subject: [PATCH] normalize_thickness -> apply_subscale --- NAMESPACE | 8 +++--- R/geom_dotsinterval.R | 3 +- R/geom_interval.R | 2 +- R/geom_pointinterval.R | 2 +- R/geom_slabinterval.R | 55 ++++++++++++++---------------------- R/subscale.R | 31 ++++++++++++++++++++ man/geom_blur_dots.Rd | 2 +- man/geom_dots.Rd | 2 +- man/geom_dotsinterval.Rd | 2 +- man/geom_slab.Rd | 17 +++++++++-- man/geom_slabinterval.Rd | 17 +++++++++-- man/geom_spike.Rd | 17 +++++++++-- man/geom_swarm.Rd | 2 +- man/geom_weave.Rd | 2 +- man/stat_ccdfinterval.Rd | 15 ++++++++-- man/stat_cdfinterval.Rd | 15 ++++++++-- man/stat_dots.Rd | 2 +- man/stat_dotsinterval.Rd | 2 +- man/stat_eye.Rd | 15 ++++++++-- man/stat_gradientinterval.Rd | 15 ++++++++-- man/stat_halfeye.Rd | 15 ++++++++-- man/stat_histinterval.Rd | 15 ++++++++-- man/stat_mcse_dots.Rd | 2 +- man/stat_slab.Rd | 15 ++++++++-- man/stat_slabinterval.Rd | 15 ++++++++-- man/stat_spike.Rd | 15 ++++++++-- 26 files changed, 230 insertions(+), 73 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 2a43c471..25752cb1 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -3,6 +3,10 @@ S3method(Mode,default) S3method(Mode,distribution) S3method(Mode,rvar) +S3method(apply_subscale,"NULL") +S3method(apply_subscale,data.frame) +S3method(apply_subscale,default) +S3method(apply_subscale,ggdist_thickness) S3method(cdf,ggdist__weighted_sample) S3method(cdf,ggdist__wrapped_categorical) S3method(curve_interval,data.frame) @@ -33,10 +37,6 @@ S3method(is.na,ggdist_partial_colour_ramp) S3method(is.na,ggdist_thickness) S3method(makeContent,dots_grob) S3method(mean,ggdist__weighted_sample) -S3method(normalize_thickness,"NULL") -S3method(normalize_thickness,data.frame) -S3method(normalize_thickness,default) -S3method(normalize_thickness,ggdist_thickness) S3method(parse_dist,brmsprior) S3method(parse_dist,character) S3method(parse_dist,data.frame) diff --git a/R/geom_dotsinterval.R b/R/geom_dotsinterval.R index 711dd1ff..8d869042 100755 --- a/R/geom_dotsinterval.R +++ b/R/geom_dotsinterval.R @@ -577,6 +577,7 @@ GeomDotsinterval = ggproto("GeomDotsinterval", GeomSlabinterval, ), GeomSlabinterval$param_docs), default_params = defaults(list( + subscale = "thickness", normalize = "none", binwidth = NA, dotsize = 1.07, @@ -589,7 +590,7 @@ GeomDotsinterval = ggproto("GeomDotsinterval", GeomSlabinterval, ), GeomSlabinterval$default_params), hidden_params = union(c( - "normalize", "fill_type" + "subscale", "normalize", "fill_type" ), GeomSlabinterval$hidden_params), diff --git a/R/geom_interval.R b/R/geom_interval.R index a11498c4..0eef72b4 100755 --- a/R/geom_interval.R +++ b/R/geom_interval.R @@ -76,7 +76,7 @@ GeomInterval = ggproto("GeomInterval", GeomSlabinterval, hidden_params = union(c( "show_slab", "show_point", "show_interval", - "normalize", "fill_type", + "subscale", "normalize", "fill_type", "subguide", "fatten_point" ), GeomSlabinterval$hidden_params) diff --git a/R/geom_pointinterval.R b/R/geom_pointinterval.R index f397fdc4..24bd0274 100755 --- a/R/geom_pointinterval.R +++ b/R/geom_pointinterval.R @@ -71,7 +71,7 @@ GeomPointinterval = ggproto("GeomPointinterval", GeomSlabinterval, hidden_params = union(c( "show_slab", "show_point", "show_interval", - "normalize", "fill_type", + "subscale", "normalize", "fill_type", "subguide" ), GeomSlabinterval$hidden_params), diff --git a/R/geom_slabinterval.R b/R/geom_slabinterval.R index 58182524..9b48b828 100755 --- a/R/geom_slabinterval.R +++ b/R/geom_slabinterval.R @@ -6,35 +6,6 @@ # thickness handling functions ------------------------------------------------------- -#' normalize thickness values to between 0 and 1 -#' @noRd -normalize_thickness = function(x, ...) UseMethod("normalize_thickness") - -#' @export -normalize_thickness.NULL = function(x, ...) { - NULL -} - -#' @export -normalize_thickness.default = function(x, subscale = subscale_thickness) { - subscale(x) -} - -#' @importFrom scales oob_squish_infinite -#' @export -normalize_thickness.ggdist_thickness = function(x, ...) { - # thickness values passed directly into the geom (e.g. by - # scale_thickness_shared()) are not normalized again. - x -} - -#' @export -normalize_thickness.data.frame = function(x, ...) { - x$thickness = normalize_thickness(x$thickness, ...) - x -} - - #' rescale the slab data (ymin / ymax) to be within the confines of the bounding box #' we do this *again* here (rather than in setup_data) because #' position_dodge doesn't work if we only do it up there: @@ -622,8 +593,21 @@ GeomSlabinterval = ggproto("GeomSlabinterval", AbstractGeom, param_docs = defaults(list( # SLAB PARAMS + subscale = glue_doc(' + Sub-scale used to scale values of the `thickness` aesthetic within + the groups determined by `normalize`. One of: + \\itemize{ + \\item A function that takes an `x` argument giving a numeric vector + 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"`. + } + For a comprehensive discussion and examples of slab scaling and normalization, see the + [`thickness` scale article](https://mjskay.github.io/ggdist/articles/thickness.html). + '), normalize = glue_doc(' - How to normalize heights of functions input to the `thickness` aesthetic. One of: + Groups within which to scale values of the `thickness` aesthetic. One of: \\itemize{ \\item `"all"`: normalize so that the maximum height across all data is `1`. \\item `"panels"`: normalize within panels so that the maximum height in each panel is `1`. @@ -700,13 +684,14 @@ 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"`. } ') ), AbstractGeom$param_docs), default_params = list( orientation = NA, + subscale = "thickness", normalize = "all", fill_type = "segments", interval_size_domain = c(1, 6), @@ -779,11 +764,12 @@ GeomSlabinterval = ggproto("GeomSlabinterval", AbstractGeom, # must do this here: not setup_data, so it happens after the thickness scale # has been applied; and not draw_panel, because normalization may be applied # across panels. + subscale_fun = match_function(params$subscale, "subscale_") switch(params$normalize, all = { # normalize so max height across all data is 1 # this preserves slabs across groups in slab plots - data = normalize_thickness(data) + data = apply_subscale(data, subscale = subscale_fun) }, panels = , xy = , @@ -794,11 +780,12 @@ GeomSlabinterval = ggproto("GeomSlabinterval", AbstractGeom, xy = c("PANEL", y), groups = c("PANEL", y, "group") ) - data = ddply_(data, normalization_groups, normalize_thickness) + data = ddply_(data, normalization_groups, apply_subscale, subscale = subscale_fun) }, none = { # ensure thickness is a thickness-type vector so it is not normalized again - data$thickness = normalize_thickness(data$thickness, subscale = subscale_identity) + # TODO: deprecate this and direct people to use `subscale = "identity"` to turn off scaling + data$thickness = apply_subscale(data$thickness, subscale = subscale_identity) }, stop0('`normalize` must be "all", "panels", "xy", groups", or "none", not "', params$normalize, '"') ) diff --git a/R/subscale.R b/R/subscale.R index f9c3a224..9650b7d6 100755 --- a/R/subscale.R +++ b/R/subscale.R @@ -74,6 +74,37 @@ subscale_identity = function(x) { } +# apply a thickness subscale ---------------------------------------------- + +#' apply a thickness subscale to an object +#' @noRd +apply_subscale = function(x, subscale) UseMethod("apply_subscale") + +#' @export +apply_subscale.NULL = function(x, subscale) { + NULL +} + +#' @export +apply_subscale.default = function(x, subscale) { + subscale(x) +} + +#' @importFrom scales oob_squish_infinite +#' @export +apply_subscale.ggdist_thickness = function(x, subscale) { + # thickness values passed directly into the geom (e.g. by + # scale_thickness_shared()) are not normalized again. + x +} + +#' @export +apply_subscale.data.frame = function(x, subscale) { + x$thickness = apply_subscale(x$thickness, subscale = subscale) + x +} + + # helpers ----------------------------------------------------------------- #' Validate an `expand` argument and return a canonical version diff --git a/man/geom_blur_dots.Rd b/man/geom_blur_dots.Rd index cc7048da..64b227c1 100755 --- a/man/geom_blur_dots.Rd +++ b/man/geom_blur_dots.Rd @@ -208,7 +208,7 @@ 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"}. }} \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 fe3abdd3..2df92d53 100755 --- a/man/geom_dots.Rd +++ b/man/geom_dots.Rd @@ -196,7 +196,7 @@ 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"}. }} \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 0c428b38..ed9139fc 100644 --- a/man/geom_dotsinterval.Rd +++ b/man/geom_dotsinterval.Rd @@ -231,7 +231,7 @@ 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"}. }} \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 1714b4bb..aee2a6c0 100755 --- a/man/geom_slab.Rd +++ b/man/geom_slab.Rd @@ -11,6 +11,7 @@ geom_slab( position = "identity", ..., orientation = NA, + subscale = "thickness", normalize = "all", fill_type = "segments", subguide = "none", @@ -68,7 +69,19 @@ For compatibility with the base ggplot naming scheme for \code{orientation}, \co for \code{"vertical"} and \code{"y"} as an alias for \code{"horizontal"} (\pkg{ggdist} had an \code{orientation} parameter before base ggplot did, hence the discrepancy).} -\item{normalize}{How to normalize heights of functions input to the \code{thickness} aesthetic. One of: +\item{subscale}{Sub-scale used to scale values of the \code{thickness} aesthetic within +the groups determined by \code{normalize}. One of: +\itemize{ +\item A function that takes an \code{x} argument giving a numeric vector +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"}. +} +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{normalize}{Groups within which to scale values of the \code{thickness} aesthetic. One of: \itemize{ \item \code{"all"}: normalize so that the maximum height across all data is \code{1}. \item \code{"panels"}: normalize within panels so that the maximum height in each panel is \code{1}. @@ -110,7 +123,7 @@ 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"}. }} \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 d97ec472..98ba2bfe 100644 --- a/man/geom_slabinterval.Rd +++ b/man/geom_slabinterval.Rd @@ -11,6 +11,7 @@ geom_slabinterval( position = "identity", ..., orientation = NA, + subscale = "thickness", normalize = "all", fill_type = "segments", interval_size_domain = c(1, 6), @@ -75,7 +76,19 @@ For compatibility with the base ggplot naming scheme for \code{orientation}, \co for \code{"vertical"} and \code{"y"} as an alias for \code{"horizontal"} (\pkg{ggdist} had an \code{orientation} parameter before base ggplot did, hence the discrepancy).} -\item{normalize}{How to normalize heights of functions input to the \code{thickness} aesthetic. One of: +\item{subscale}{Sub-scale used to scale values of the \code{thickness} aesthetic within +the groups determined by \code{normalize}. One of: +\itemize{ +\item A function that takes an \code{x} argument giving a numeric vector +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"}. +} +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{normalize}{Groups within which to scale values of the \code{thickness} aesthetic. One of: \itemize{ \item \code{"all"}: normalize so that the maximum height across all data is \code{1}. \item \code{"panels"}: normalize within panels so that the maximum height in each panel is \code{1}. @@ -145,7 +158,7 @@ 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"}. }} \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 e07bb89e..997a2052 100755 --- a/man/geom_spike.Rd +++ b/man/geom_spike.Rd @@ -11,6 +11,7 @@ geom_spike( position = "identity", ..., orientation = NA, + subscale = "thickness", normalize = "all", arrow = NULL, subguide = "none", @@ -68,7 +69,19 @@ For compatibility with the base ggplot naming scheme for \code{orientation}, \co for \code{"vertical"} and \code{"y"} as an alias for \code{"horizontal"} (\pkg{ggdist} had an \code{orientation} parameter before base ggplot did, hence the discrepancy).} -\item{normalize}{How to normalize heights of functions input to the \code{thickness} aesthetic. One of: +\item{subscale}{Sub-scale used to scale values of the \code{thickness} aesthetic within +the groups determined by \code{normalize}. One of: +\itemize{ +\item A function that takes an \code{x} argument giving a numeric vector +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"}. +} +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{normalize}{Groups within which to scale values of the \code{thickness} aesthetic. One of: \itemize{ \item \code{"all"}: normalize so that the maximum height across all data is \code{1}. \item \code{"panels"}: normalize within panels so that the maximum height in each panel is \code{1}. @@ -93,7 +106,7 @@ 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"}. }} \item{na.rm}{If \code{FALSE}, the default, missing values are removed with a warning. If \code{TRUE}, missing diff --git a/man/geom_swarm.Rd b/man/geom_swarm.Rd index e3a97a47..6796d42c 100755 --- a/man/geom_swarm.Rd +++ b/man/geom_swarm.Rd @@ -196,7 +196,7 @@ 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"}. }} \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 da96be19..075a0340 100755 --- a/man/geom_weave.Rd +++ b/man/geom_weave.Rd @@ -196,7 +196,7 @@ 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"}. }} \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 143b224e..1a88b42a 100755 --- a/man/stat_ccdfinterval.Rd +++ b/man/stat_ccdfinterval.Rd @@ -63,6 +63,17 @@ 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_slabinterval]{geom_slabinterval()}}, these include: \describe{ +\item{\code{subscale}}{Sub-scale used to scale values of the \code{thickness} aesthetic within +the groups determined by \code{normalize}. One of: +\itemize{ +\item A function that takes an \code{x} argument giving a numeric vector +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"}. +} +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{fill_type}}{What type of fill to use when the fill color or alpha varies within a slab. One of: \itemize{ \item \code{"segments"}: breaks up the slab geometry into segments for each unique combination of fill color and @@ -108,11 +119,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"}. }} }} -\item{normalize}{How to normalize heights of functions input to the \code{thickness} aesthetic. One of: +\item{normalize}{Groups within which to scale values of the \code{thickness} aesthetic. One of: \itemize{ \item \code{"all"}: normalize so that the maximum height across all data is \code{1}. \item \code{"panels"}: normalize within panels so that the maximum height in each panel is \code{1}. diff --git a/man/stat_cdfinterval.Rd b/man/stat_cdfinterval.Rd index 51b2a016..d12142b3 100755 --- a/man/stat_cdfinterval.Rd +++ b/man/stat_cdfinterval.Rd @@ -63,6 +63,17 @@ 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_slabinterval]{geom_slabinterval()}}, these include: \describe{ +\item{\code{subscale}}{Sub-scale used to scale values of the \code{thickness} aesthetic within +the groups determined by \code{normalize}. One of: +\itemize{ +\item A function that takes an \code{x} argument giving a numeric vector +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"}. +} +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{fill_type}}{What type of fill to use when the fill color or alpha varies within a slab. One of: \itemize{ \item \code{"segments"}: breaks up the slab geometry into segments for each unique combination of fill color and @@ -108,11 +119,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"}. }} }} -\item{normalize}{How to normalize heights of functions input to the \code{thickness} aesthetic. One of: +\item{normalize}{Groups within which to scale values of the \code{thickness} aesthetic. One of: \itemize{ \item \code{"all"}: normalize so that the maximum height across all data is \code{1}. \item \code{"panels"}: normalize within panels so that the maximum height in each panel is \code{1}. diff --git a/man/stat_dots.Rd b/man/stat_dots.Rd index 74ba11e7..e2f152f2 100755 --- a/man/stat_dots.Rd +++ b/man/stat_dots.Rd @@ -165,7 +165,7 @@ 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"}. }} }} diff --git a/man/stat_dotsinterval.Rd b/man/stat_dotsinterval.Rd index fefc72ae..ee1a8395 100755 --- a/man/stat_dotsinterval.Rd +++ b/man/stat_dotsinterval.Rd @@ -185,7 +185,7 @@ 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"}. }} }} diff --git a/man/stat_eye.Rd b/man/stat_eye.Rd index 56e0d0c9..5939809d 100755 --- a/man/stat_eye.Rd +++ b/man/stat_eye.Rd @@ -62,7 +62,18 @@ 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_slabinterval]{geom_slabinterval()}}, these include: \describe{ -\item{\code{normalize}}{How to normalize heights of functions input to the \code{thickness} aesthetic. One of: +\item{\code{subscale}}{Sub-scale used to scale values of the \code{thickness} aesthetic within +the groups determined by \code{normalize}. One of: +\itemize{ +\item A function that takes an \code{x} argument giving a numeric vector +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"}. +} +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{normalize}}{Groups within which to scale values of the \code{thickness} aesthetic. One of: \itemize{ \item \code{"all"}: normalize so that the maximum height across all data is \code{1}. \item \code{"panels"}: normalize within panels so that the maximum height in each panel is \code{1}. @@ -120,7 +131,7 @@ 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"}. }} }} diff --git a/man/stat_gradientinterval.Rd b/man/stat_gradientinterval.Rd index fabb1342..f9a83e76 100755 --- a/man/stat_gradientinterval.Rd +++ b/man/stat_gradientinterval.Rd @@ -63,7 +63,18 @@ 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_slabinterval]{geom_slabinterval()}}, these include: \describe{ -\item{\code{normalize}}{How to normalize heights of functions input to the \code{thickness} aesthetic. One of: +\item{\code{subscale}}{Sub-scale used to scale values of the \code{thickness} aesthetic within +the groups determined by \code{normalize}. One of: +\itemize{ +\item A function that takes an \code{x} argument giving a numeric vector +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"}. +} +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{normalize}}{Groups within which to scale values of the \code{thickness} aesthetic. One of: \itemize{ \item \code{"all"}: normalize so that the maximum height across all data is \code{1}. \item \code{"panels"}: normalize within panels so that the maximum height in each panel is \code{1}. @@ -103,7 +114,7 @@ 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"}. }} }} diff --git a/man/stat_halfeye.Rd b/man/stat_halfeye.Rd index 1e76d3c0..85e37f37 100755 --- a/man/stat_halfeye.Rd +++ b/man/stat_halfeye.Rd @@ -62,7 +62,18 @@ 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_slabinterval]{geom_slabinterval()}}, these include: \describe{ -\item{\code{normalize}}{How to normalize heights of functions input to the \code{thickness} aesthetic. One of: +\item{\code{subscale}}{Sub-scale used to scale values of the \code{thickness} aesthetic within +the groups determined by \code{normalize}. One of: +\itemize{ +\item A function that takes an \code{x} argument giving a numeric vector +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"}. +} +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{normalize}}{Groups within which to scale values of the \code{thickness} aesthetic. One of: \itemize{ \item \code{"all"}: normalize so that the maximum height across all data is \code{1}. \item \code{"panels"}: normalize within panels so that the maximum height in each panel is \code{1}. @@ -120,7 +131,7 @@ 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"}. }} }} diff --git a/man/stat_histinterval.Rd b/man/stat_histinterval.Rd index 4d977d66..9b5b2eb9 100755 --- a/man/stat_histinterval.Rd +++ b/man/stat_histinterval.Rd @@ -62,7 +62,18 @@ 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_slabinterval]{geom_slabinterval()}}, these include: \describe{ -\item{\code{normalize}}{How to normalize heights of functions input to the \code{thickness} aesthetic. One of: +\item{\code{subscale}}{Sub-scale used to scale values of the \code{thickness} aesthetic within +the groups determined by \code{normalize}. One of: +\itemize{ +\item A function that takes an \code{x} argument giving a numeric vector +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"}. +} +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{normalize}}{Groups within which to scale values of the \code{thickness} aesthetic. One of: \itemize{ \item \code{"all"}: normalize so that the maximum height across all data is \code{1}. \item \code{"panels"}: normalize within panels so that the maximum height in each panel is \code{1}. @@ -120,7 +131,7 @@ 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"}. }} }} diff --git a/man/stat_mcse_dots.Rd b/man/stat_mcse_dots.Rd index 3c6ffdff..d293ea38 100755 --- a/man/stat_mcse_dots.Rd +++ b/man/stat_mcse_dots.Rd @@ -175,7 +175,7 @@ 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"}. }} }} diff --git a/man/stat_slab.Rd b/man/stat_slab.Rd index 5132d339..0c9442f0 100755 --- a/man/stat_slab.Rd +++ b/man/stat_slab.Rd @@ -60,7 +60,18 @@ 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_slab]{geom_slab()}}, these include: \describe{ -\item{\code{normalize}}{How to normalize heights of functions input to the \code{thickness} aesthetic. One of: +\item{\code{subscale}}{Sub-scale used to scale values of the \code{thickness} aesthetic within +the groups determined by \code{normalize}. One of: +\itemize{ +\item A function that takes an \code{x} argument giving a numeric vector +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"}. +} +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{normalize}}{Groups within which to scale values of the \code{thickness} aesthetic. One of: \itemize{ \item \code{"all"}: normalize so that the maximum height across all data is \code{1}. \item \code{"panels"}: normalize within panels so that the maximum height in each panel is \code{1}. @@ -100,7 +111,7 @@ 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"}. }} }} diff --git a/man/stat_slabinterval.Rd b/man/stat_slabinterval.Rd index 58f1dd91..069c1dea 100755 --- a/man/stat_slabinterval.Rd +++ b/man/stat_slabinterval.Rd @@ -62,7 +62,18 @@ 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_slabinterval]{geom_slabinterval()}}, these include: \describe{ -\item{\code{normalize}}{How to normalize heights of functions input to the \code{thickness} aesthetic. One of: +\item{\code{subscale}}{Sub-scale used to scale values of the \code{thickness} aesthetic within +the groups determined by \code{normalize}. One of: +\itemize{ +\item A function that takes an \code{x} argument giving a numeric vector +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"}. +} +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{normalize}}{Groups within which to scale values of the \code{thickness} aesthetic. One of: \itemize{ \item \code{"all"}: normalize so that the maximum height across all data is \code{1}. \item \code{"panels"}: normalize within panels so that the maximum height in each panel is \code{1}. @@ -120,7 +131,7 @@ 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"}. }} }} diff --git a/man/stat_spike.Rd b/man/stat_spike.Rd index 0b2a1d03..38a529ac 100755 --- a/man/stat_spike.Rd +++ b/man/stat_spike.Rd @@ -60,7 +60,18 @@ 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{normalize}}{How to normalize heights of functions input to the \code{thickness} aesthetic. One of: +\item{\code{subscale}}{Sub-scale used to scale values of the \code{thickness} aesthetic within +the groups determined by \code{normalize}. One of: +\itemize{ +\item A function that takes an \code{x} argument giving a numeric vector +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"}. +} +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{normalize}}{Groups within which to scale values of the \code{thickness} aesthetic. One of: \itemize{ \item \code{"all"}: normalize so that the maximum height across all data is \code{1}. \item \code{"panels"}: normalize within panels so that the maximum height in each panel is \code{1}. @@ -83,7 +94,7 @@ 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"}. }} }}