type_boxplot | R Documentation |
Type function for producing box-and-whisker plots.
Arguments are passed to boxplot
, although tinyplot
scaffolding allows added functionality such as grouping and faceting.
Box-and-whisker plots are the default plot type if x
is a factor and y
is
numeric.
type_boxplot(
range = 1.5,
width = NULL,
varwidth = FALSE,
notch = FALSE,
outline = TRUE,
boxwex = 0.8,
staplewex = 0.5,
outwex = 0.5
)
range |
this determines how far the plot whiskers extend out
from the box. If |
width |
a vector giving the relative widths of the boxes making up the plot. |
varwidth |
if |
notch |
if |
outline |
if |
boxwex |
a scale factor to be applied to all boxes. When there are only a few groups, the appearance of the plot can be improved by making the boxes narrower. |
staplewex |
staple line width expansion, proportional to box width. |
outwex |
outlier line width expansion, proportional to box width. |
# "boxplot" type convenience string
tinyplot(count ~ spray, data = InsectSprays, type = "boxplot")
# Note: Specifying the type here is redundant. Like base plot, tinyplot
# automatically produces a boxplot if x is a factor and y is numeric
tinyplot(count ~ spray, data = InsectSprays)
# Grouped boxplot example
tinyplot(len ~ dose | supp, data = ToothGrowth, type = "boxplot")
# Use `type_boxplot()` to pass extra arguments for customization
tinyplot(
len ~ dose | supp, data = ToothGrowth, lty = 1,
type = type_boxplot(boxwex = 0.3, staplewex = 0, outline = FALSE)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.