mplot3_box | R Documentation |
mplot3
: BoxplotDraw boxplots of a vector (single box), data.frame (one box per column) or list (one box per element - good for variable of different length)
mplot3_box(
x,
col = NULL,
alpha = 0.66,
border = NULL,
border.alpha = 1,
group.spacing = 0.25,
xlim = NULL,
ylim = NULL,
xlab = NULL,
ylab = NULL,
boxwex = NULL,
staplewex = 0.5,
horizontal = FALSE,
main = NULL,
groupnames = NULL,
xnames = NULL,
xnames.at = NULL,
xnames.y = NULL,
xnames.font = 1,
xnames.adj = NULL,
xnames.pos = NULL,
xnames.srt = NULL,
order.by.fn = NULL,
legend = FALSE,
legend.names = NULL,
legend.position = "topright",
legend.inset = c(0, 0),
mar = NULL,
oma = rep(0, 4),
pty = "m",
yaxis = TRUE,
ylim.pad = 0,
theme = rtTheme,
labelify = TRUE,
autolabel = letters,
na.rm = TRUE,
palette = rtPalette,
par.reset = TRUE,
pdf.width = 6,
pdf.height = 6,
filename = NULL,
...
)
x |
Vector, data.frame or list: Each data.frame column or list element will be drawn as a box |
col |
Vector of colors to use |
alpha |
Numeric: |
border |
Color for lines around boxes |
border.alpha |
Numeric: |
group.spacing |
Numeric: Spacing between groups of boxes (when input is data.frame or list) |
xlim |
Float vector, length 2: x-axis limits |
ylim |
Float vector, length 2: y-axis limits |
xlab |
Character: x-axis label |
ylab |
Character: y-axis label |
boxwex |
Numeric: Scale factor for box width. Default = .5 |
staplewex |
Numeric: max and min line ("staple") width proportional to box. Default = .5 |
horizontal |
Logical: If TRUE, draw horizontal boxplot(s). |
main |
Character: Plot title |
groupnames |
Character vector: Group names |
xnames |
Character vector: Names for individual boxes |
xnames.at |
Numeric: Position of xnames |
order.by.fn |
Character: "mean", "median" or any function that outputs a single number: E stimate function on each vector and order boxes (when input is data.frame or list) by ascending order. Default = NULL, i.e. no reordering |
mar |
Float, vector, length 4: Margins; see |
oma |
Float, vector, length 4: Outer margins; see |
pty |
Character: "s" gives a square plot; "m" gives a plot that fills
graphics device size. Default = "m" (See |
theme |
Character: Run |
autolabel |
Character vector to be used to generate autolabels when using
rtlayout with |
na.rm |
Logical: If TRUE, remove NA values, otherwise function will give error. Default = TRUE |
palette |
Vector of colors, or Character defining a builtin palette -
get options with |
par.reset |
Logical: If TRUE, reset |
pdf.width |
Float: Width in inches for pdf output (if |
pdf.height |
Float: Height in inches for pdf output. |
filename |
Character: Path to file to save plot. Default = NULL |
... |
Additional arguments to |
Note that argument xnames
refers to the x-axis labels below each box. If not specified, these
are inferred from the input when possible. Argument xlab
is a single label for the x-axis as
per usual and often omitted if xnames
suffice.
E.D. Gennatas
## Not run:
## vector
x <- rnorm(500)
mplot3_box(x)
## data.frame - each column one boxplot
x <- data.frame(alpha = rnorm(50), beta = rnorm(50), gamma = rnorm(50))
mplot3_box(x)
## list of vectors - allows different length vectors
x <- list(alpha = rnorm(50),
beta = rnorm(80, 4, 1.5),
gamma = rnorm(30, -3, .5))
mplot3_box(x)
## grouped boxplots: input a list of lists. outer list: groups; inner lists: matched data vectors
x <- list(Cases = list(Weight = rnorm(50), Temperature = rnorm(45, 1)),
Controls = list(Weight = rnorm(80), Temperature = rnorm(72)))
mplot3_box(x)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.