From e8a388e8c8d837305b14947ff1a82ad4376cbda7 Mon Sep 17 00:00:00 2001 From: Joshua Wu <124658199+joshhwuu@users.noreply.github.com> Date: Fri, 23 Feb 2024 03:04:20 -0800 Subject: [PATCH] Fixing documentation in binned_scale suggesting it defaults to oob = censor (#5691) * Fixed documentation for binned_scaled defaulting to oob = squish * Fixed documentation for binned_scaled defaulting to oob = squish * Changed roxygen2 documentation for binned scale * Dismiss older Hmisc changes --------- Co-authored-by: josh w Co-authored-by: Teun van den Brand Co-authored-by: Teun van den Brand <49372158+teunbrand@users.noreply.github.com> --- DESCRIPTION | 2 +- R/scale-.R | 8 ++++++++ man/aes_colour_fill_alpha.Rd | 4 ++-- man/aes_group_order.Rd | 4 ++-- man/aes_linetype_size_shape.Rd | 4 ++-- man/aes_position.Rd | 4 ++-- man/binned_scale.Rd | 6 +++--- man/position_dodge.Rd | 2 +- man/position_identity.Rd | 2 +- man/position_nudge.Rd | 2 +- man/position_stack.Rd | 2 +- man/scale_binned.Rd | 6 +++--- man/scale_steps.Rd | 20 ++++++++++---------- 13 files changed, 37 insertions(+), 29 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 093493c894..89b0a43129 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -79,7 +79,7 @@ Config/testthat/edition: 3 Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.0 +RoxygenNote: 7.3.1 Collate: 'ggproto.R' 'ggplot-global.R' diff --git a/R/scale-.R b/R/scale-.R index 036e0052a9..bd80ca3ff2 100644 --- a/R/scale-.R +++ b/R/scale-.R @@ -257,6 +257,14 @@ discrete_scale <- function(aesthetics, scale_name = deprecated(), palette, name #' the scale will ask the transformation object to create breaks, and this #' may result in a different number of breaks than requested. Ignored if #' breaks are given explicitly. +#' @param oob One of: +#' - Function that handles limits outside of the scale limits +#' (out of bounds). Also accepts rlang [lambda][rlang::as_function()] +#' function notation. +#' - The default ([scales::squish()]) squishes out of +#' bounds values into range. +#' - [scales::censor] for replacing out of bounds values with `NA`. +#' - [scales::squish_infinite()] for squishing infinite values into range. #' @param right Should the intervals be closed on the right (`TRUE`, default) or #' should the intervals be closed on the left (`FALSE`)? 'Closed on the right' #' means that values at break positions are part of the lower bin (open on the diff --git a/man/aes_colour_fill_alpha.Rd b/man/aes_colour_fill_alpha.Rd index e521321488..282337837a 100644 --- a/man/aes_colour_fill_alpha.Rd +++ b/man/aes_colour_fill_alpha.Rd @@ -122,9 +122,9 @@ can be modified. } Other aesthetics documentation: +\code{\link{aes}()}, \code{\link{aes_group_order}}, \code{\link{aes_linetype_size_shape}}, -\code{\link{aes_position}}, -\code{\link{aes}()} +\code{\link{aes_position}} } \concept{aesthetics documentation} diff --git a/man/aes_group_order.Rd b/man/aes_group_order.Rd index c56cd18aff..09accf2017 100644 --- a/man/aes_group_order.Rd +++ b/man/aes_group_order.Rd @@ -92,9 +92,9 @@ can be modified. } Other aesthetics documentation: +\code{\link{aes}()}, \code{\link{aes_colour_fill_alpha}}, \code{\link{aes_linetype_size_shape}}, -\code{\link{aes_position}}, -\code{\link{aes}()} +\code{\link{aes_position}} } \concept{aesthetics documentation} diff --git a/man/aes_linetype_size_shape.Rd b/man/aes_linetype_size_shape.Rd index c1f0e48082..952baadf5a 100644 --- a/man/aes_linetype_size_shape.Rd +++ b/man/aes_linetype_size_shape.Rd @@ -109,9 +109,9 @@ can be modified. } Other aesthetics documentation: +\code{\link{aes}()}, \code{\link{aes_colour_fill_alpha}}, \code{\link{aes_group_order}}, -\code{\link{aes_position}}, -\code{\link{aes}()} +\code{\link{aes_position}} } \concept{aesthetics documentation} diff --git a/man/aes_position.Rd b/man/aes_position.Rd index 79643fa48f..6777676b90 100644 --- a/man/aes_position.Rd +++ b/man/aes_position.Rd @@ -98,9 +98,9 @@ ggplot(counts, aes(x = x, y = Freq)) + } Other aesthetics documentation: +\code{\link{aes}()}, \code{\link{aes_colour_fill_alpha}}, \code{\link{aes_group_order}}, -\code{\link{aes_linetype_size_shape}}, -\code{\link{aes}()} +\code{\link{aes_linetype_size_shape}} } \concept{aesthetics documentation} diff --git a/man/binned_scale.Rd b/man/binned_scale.Rd index b03ae8201b..8407c74658 100644 --- a/man/binned_scale.Rd +++ b/man/binned_scale.Rd @@ -91,9 +91,9 @@ scales, which always use \code{\link[scales:rescale]{scales::rescale()}}. Also a \item Function that handles limits outside of the scale limits (out of bounds). Also accepts rlang \link[rlang:as_function]{lambda} function notation. -\item The default (\code{\link[scales:oob]{scales::censor()}}) replaces out of -bounds values with \code{NA}. -\item \code{\link[scales:oob]{scales::squish()}} for squishing out of bounds values into range. +\item The default (\code{\link[scales:oob]{scales::squish()}}) squishes out of +bounds values into range. +\item \link[scales:oob]{scales::censor} for replacing out of bounds values with \code{NA}. \item \code{\link[scales:oob]{scales::squish_infinite()}} for squishing infinite values into range. }} diff --git a/man/position_dodge.Rd b/man/position_dodge.Rd index 01608e13db..b42353b35e 100644 --- a/man/position_dodge.Rd +++ b/man/position_dodge.Rd @@ -105,8 +105,8 @@ ggplot(mtcars, aes(factor(cyl), fill = factor(vs))) + \seealso{ Other position adjustments: \code{\link{position_identity}()}, -\code{\link{position_jitterdodge}()}, \code{\link{position_jitter}()}, +\code{\link{position_jitterdodge}()}, \code{\link{position_nudge}()}, \code{\link{position_stack}()} } diff --git a/man/position_identity.Rd b/man/position_identity.Rd index f21880dce0..26e840cfaa 100644 --- a/man/position_identity.Rd +++ b/man/position_identity.Rd @@ -12,8 +12,8 @@ Don't adjust position \seealso{ Other position adjustments: \code{\link{position_dodge}()}, -\code{\link{position_jitterdodge}()}, \code{\link{position_jitter}()}, +\code{\link{position_jitterdodge}()}, \code{\link{position_nudge}()}, \code{\link{position_stack}()} } diff --git a/man/position_nudge.Rd b/man/position_nudge.Rd index c52703d1e3..3b2b2573cb 100644 --- a/man/position_nudge.Rd +++ b/man/position_nudge.Rd @@ -38,8 +38,8 @@ ggplot(df, aes(x, y)) + Other position adjustments: \code{\link{position_dodge}()}, \code{\link{position_identity}()}, -\code{\link{position_jitterdodge}()}, \code{\link{position_jitter}()}, +\code{\link{position_jitterdodge}()}, \code{\link{position_stack}()} } \concept{position adjustments} diff --git a/man/position_stack.Rd b/man/position_stack.Rd index 2c3eae4bbc..024bfd80a4 100644 --- a/man/position_stack.Rd +++ b/man/position_stack.Rd @@ -150,8 +150,8 @@ more examples. Other position adjustments: \code{\link{position_dodge}()}, \code{\link{position_identity}()}, -\code{\link{position_jitterdodge}()}, \code{\link{position_jitter}()}, +\code{\link{position_jitterdodge}()}, \code{\link{position_nudge}()} } \concept{position adjustments} diff --git a/man/scale_binned.Rd b/man/scale_binned.Rd index 1d9bf4bc58..4c330f0a71 100644 --- a/man/scale_binned.Rd +++ b/man/scale_binned.Rd @@ -104,9 +104,9 @@ expand the scale by 5\% on each side for continuous variables, and by \item Function that handles limits outside of the scale limits (out of bounds). Also accepts rlang \link[rlang:as_function]{lambda} function notation. -\item The default (\code{\link[scales:oob]{scales::censor()}}) replaces out of -bounds values with \code{NA}. -\item \code{\link[scales:oob]{scales::squish()}} for squishing out of bounds values into range. +\item The default (\code{\link[scales:oob]{scales::squish()}}) squishes out of +bounds values into range. +\item \link[scales:oob]{scales::censor} for replacing out of bounds values with \code{NA}. \item \code{\link[scales:oob]{scales::squish_infinite()}} for squishing infinite values into range. }} diff --git a/man/scale_steps.Rd b/man/scale_steps.Rd index 97ee769de7..314e066208 100644 --- a/man/scale_steps.Rd +++ b/man/scale_steps.Rd @@ -102,6 +102,16 @@ instead of exactly evenly spaced between the limits. If \code{TRUE} (default) the scale will ask the transformation object to create breaks, and this may result in a different number of breaks than requested. Ignored if breaks are given explicitly.} + \item{\code{oob}}{One of: +\itemize{ +\item Function that handles limits outside of the scale limits +(out of bounds). Also accepts rlang \link[rlang:as_function]{lambda} +function notation. +\item The default (\code{\link[scales:oob]{scales::squish()}}) squishes out of +bounds values into range. +\item \link[scales:oob]{scales::censor} for replacing out of bounds values with \code{NA}. +\item \code{\link[scales:oob]{scales::squish_infinite()}} for squishing infinite values into range. +}} \item{\code{right}}{Should the intervals be closed on the right (\code{TRUE}, default) or should the intervals be closed on the left (\code{FALSE})? 'Closed on the right' means that values at break positions are part of the lower bin (open on the @@ -140,16 +150,6 @@ notation. Note that setting limits on positional scales will \strong{remove} data outside of the limits. If the purpose is to zoom, use the limit argument in the coordinate system (see \code{\link[=coord_cartesian]{coord_cartesian()}}). -}} - \item{\code{oob}}{One of: -\itemize{ -\item Function that handles limits outside of the scale limits -(out of bounds). Also accepts rlang \link[rlang:as_function]{lambda} -function notation. -\item The default (\code{\link[scales:oob]{scales::censor()}}) replaces out of -bounds values with \code{NA}. -\item \code{\link[scales:oob]{scales::squish()}} for squishing out of bounds values into range. -\item \code{\link[scales:oob]{scales::squish_infinite()}} for squishing infinite values into range. }} \item{\code{trans}}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Deprecated in favour of \code{transform}.}