View source: R/tufte_boxplot.R
prepare_tufte | R Documentation |
This function prepares the elements necessary to draw a variant of the boxplot proposed by Edward Tufte.
prepare_tufte(x = "", ymin, lower, middle, upper, ymax, ...)
x |
character string with the name of the variable to be plotted on the x-axis |
ymin |
name of the column with the minimum value of y to be plotted |
lower |
name of the column with the lower part of the "box" of the boxplot |
middle |
name of the column with the middle point of the boxplot (usually the median) |
upper |
name of the column with the upper part of the "box" of the boxplot |
ymax |
name of the column with the maximum value of y to be plotted |
... |
other aesthetic mappings created by |
a list with three elements: two geom_linerange
s and a geom_point
.
prepare_tufte_
which does quite the same things but, instead of character arguments, uses
one-sided formula
to set aesthetic mappings.
data("c02_14")
l <- prepare_tufte(x = "sesso", ymin = "p10", lower = "p25",
middle = "p50", upper = "p75", ymax = "p90")
# Tufte boxplot of the first row of the data:
tufte_boxplot(data = c02_14[1, ], l)
# Tufte boxplot of the first three rows:
tufte_boxplot(data = c02_14[1:3, ], l)
l
str(l)
# An example where we plot boxplots for each group:
l <- prepare_tufte(x = "id", ymin = "p10", lower = "p25",
middle = "p50", upper = "p75", ymax = "p90")
tufte_boxplot(data = c02_14[1, ], l)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.