View source: R/stat_boxplot_custom.R
stat_boxplot_custom | R Documentation |
stat_boxplot_custom()
modifies ggplot2::stat_boxplot()
so that it
computes the extents of the whiskers based on specified percentiles, rather
than a multiple of the IQR.
stat_boxplot_custom(
mapping = NULL,
data = NULL,
geom = "boxplot",
position = "dodge2",
...,
qs = c(0.05, 0.25, 0.5, 0.75, 0.95),
na.rm = FALSE,
orientation = NA,
show.legend = NA,
inherit.aes = TRUE
)
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
geom |
Available, but should only be 'boxplot'. |
position |
Position adjustment, either as a string naming the adjustment
(e.g. |
... |
Other arguments passed on to |
qs |
The percentiles that are used to create the lower whisker, lower hinge, middle bar, upper hinge, and upper whisker, respectively. The lower and upper whiskers default to the 5th and 95th percentiles. The hinges default to the 25th and 75th percentiles, and the middle bar defaults to the median. These values should be in increasing order, i.e., the whisker should be a smaller percentile than the lower hinge, and can only span the values from 0 to 1 (inclusive). |
na.rm |
If |
orientation |
The orientation of the layer. The default ( |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
The upper and lower whiskers extend to the first, and last entries of the
qs
parameter, respectively. Data beyond the whiskers are "outliers".
library(ggplot2)
p <- ggplot(mpg, aes(class, hwy))
# show whiskers at 5th and 95th percentiles
p + stat_boxplot_custom(qs = c(.05, .25, .5, .75, .95))
# show whiskers at 10th and 90th percentiles
p + stat_boxplot_custom(qs = c(.1, .25, .5, .75, .9))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.