From a5982116bdaf0b777466cf97a182f4eb765d22a9 Mon Sep 17 00:00:00 2001 From: Ben Bolker Date: Mon, 20 Sep 2021 20:48:07 -0400 Subject: [PATCH] note on stats='boxplot' for geom_tufteboxplot --- R/geom-tufteboxplot.R | 7 +++++++ inst/examples/ex-geom_tufteboxplot.R | 2 ++ man/geom_tufteboxplot.Rd | 11 ++++++++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/R/geom-tufteboxplot.R b/R/geom-tufteboxplot.R index 485d1119..51d6d9a0 100644 --- a/R/geom-tufteboxplot.R +++ b/R/geom-tufteboxplot.R @@ -53,6 +53,13 @@ #' @param hoffset controls how much the interquartile line is offset from the #' whiskers when \code{median.type = 'line'}. This is a fraction of the #' range of \code{x}. +#' @param stat The statistical transformation to use on the data for this +#' layer, as a string. The default (\code{stat = 'fivenumber'}) calls +#' \code{\link{stat_fivenumber}} and produces whiskers that extend +#' from the interquartile range to the extremes of the data; specifying +#' \code{\link{stat_boxplot}} will produce a more traditional boxplot +#' with whiskers extending to the most extreme points that are < 1.5 IQR +#' away from the hinges (i.e., the first and third quartiles). #' @family geom tufte #' @export #' diff --git a/inst/examples/ex-geom_tufteboxplot.R b/inst/examples/ex-geom_tufteboxplot.R index 1c0399fc..fe9f4f95 100644 --- a/inst/examples/ex-geom_tufteboxplot.R +++ b/inst/examples/ex-geom_tufteboxplot.R @@ -13,3 +13,5 @@ p + geom_tufteboxplot(median.type = "line") p + geom_tufteboxplot() + theme_tufte() + theme(axis.ticks.x = element_blank()) +# traditional boxplot with whiskers only out to 1.5 IQR, outlier points +p + geom_tufteboxplot(stat="boxplot", outlier.shape = 5) diff --git a/man/geom_tufteboxplot.Rd b/man/geom_tufteboxplot.Rd index a08f4e75..41c5cb7e 100644 --- a/man/geom_tufteboxplot.Rd +++ b/man/geom_tufteboxplot.Rd @@ -47,9 +47,12 @@ will be used as the layer data. A \code{function} can be created from a \code{formula} (e.g. \code{~ head(.x, 10)}).} \item{stat}{The statistical transformation to use on the data for this -layer, either as a \code{ggproto} \code{Geom} subclass or as a string naming the -stat stripped of the \code{stat_} prefix (e.g. \code{"count"} rather than -\code{"stat_count"})} +layer, as a string. The default (\code{stat = 'fivenumber'}) calls +\code{\link{stat_fivenumber}} and produces whiskers that extend +from the interquartile range to the extremes of the data; specifying +\code{\link{stat_boxplot}} will produce a more traditional boxplot +with whiskers extending to the most extreme points that are < 1.5 IQR +away from the hinges (i.e., the first and third quartiles).} \item{position}{Position adjustment, either as a string naming the adjustment (e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a @@ -147,6 +150,8 @@ p + geom_tufteboxplot(median.type = "line") p + geom_tufteboxplot() + theme_tufte() + theme(axis.ticks.x = element_blank()) +# traditional boxplot with whiskers only out to 1.5 IQR, outlier points +p + geom_tufteboxplot(stat="boxplot", outlier.shape = 5) } \references{ Tufte, Edward R. (2001) The Visual Display of