View source: R/box_mean_plot.R
box_mean_plot | R Documentation |
Creates a standard box plot of grouped data (line: median, box: 25 to 75 percentiles, whiskers: 1.5*IQR (interquartile range)).
box_mean_plot( d, x = NULL, y, color.group = NULL, x.axis = NULL, y.axis = NULL, legend.title = NULL, x.order = NULL, group.order = NULL, x.first = NULL, group.first = NULL, means = FALSE, boxwidth = 0.7, whisker.width = 1, mean.size = 1, points = TRUE, jitterwidth = 1, pointsize = 1, mean.type = "arithmetic" )
d |
|
x |
Character. The name of the column to be used for the x axis (categorical data).
If |
y |
Character. The name of the column to be used for the y axis (numeric data). |
color.group |
Character. The name of the column to be used for color grouping (categorical data).
If |
x.axis |
Character. Sets the title of the x axis. If |
y.axis |
Character. Sets the title of the y axis. If |
legend.title |
Character. Sets the title of the legend. If |
x.order |
Character vector of length equal to the number of x categories.
Sets the order of categories in the x axis. If |
group.order |
Character vector of length equal to the number of color grouping categories.
Sets the order of color groups. If |
x.first |
Character. Places a specific x axis category first. Ignored if |
group.first |
Character. Places a specific color group category first.
Ignored if |
means |
Logical. Sets whether or not to plot group means. Defaults to |
boxwidth |
Numeric. Sets the width of the bars. Defaults to 0.7. |
whisker.width |
Numeric. Sets the width of the error bar whiskers. Defaults to 1. |
mean.size |
Numeric. Sets the size of group mean points. Defaults to 1. |
points |
Logical. Sets whether or not to plot individual data points. Defaults to |
jitterwidth |
Numeric. The horizontal dispersion of individual data points. Defaults to 1. |
pointsize |
Numeric. Sets the size of individual data points. Defaults to 1. |
mean.type |
Character. Sets from arithmetic to geometric mean. Defaults to "arithmetic". |
To include the mean value for each group, set means
argument to TRUE
. To change between arithmetic or geometric
mean, set the mean.type
argument to "arithmetic" or "geometric".
The order of groups shown in the x axis and color groups defaults to alphabetical.
To change it, supply x.order
or group.order
arguments.
These should be character vectors with the desired order of each factor.
Do not include categories that don't exist in the supplied data.frame
.
To bring just one category first, supply x.first
or group.first
arguments.
If x.order
is supplied, x.first
will be ignored. The same holds for group.order
and group.first
.
Adjust other supplied arguments to customize the plot aesthetically.
A plot based on ggplot2
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.