View source: R/bar_point_plot.R
bar_point_plot | R Documentation |
Creates a bar plot of grouped data means plus/minus standard deviations (or custom, manually calculated error measure).
bar_point_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, points = TRUE, barwidth = 0.7, jitterwidth = 1, pointsize = 1, whisker.width = 1, mean.type = "arithmetic", error.lower = NULL, error.upper = NULL )
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 |
points |
Logical. Sets whether or not to plot individual data points. Defaults to |
barwidth |
Numeric. Sets the width of the bars. Defaults to 0.7. |
jitterwidth |
Numeric. The horizontal dispersion of individual data points. Defaults to 1. |
pointsize |
Numeric. Sets the size of individual data points. Defaults to 1. |
whisker.width |
Numeric. Sets the width of the error bar whiskers. Defaults to 1. |
mean.type |
Character, either "arithmetic" or "geometric". Sets which type of mean and standard deviation to plot. Defaults to "arithmetic". |
error.lower |
Character, name of a column in the |
error.upper |
Character, name of a column in the |
The calculations for mean and standard deviation are performed automatically. To show other error measure,
calculate it manually and include it as two fields in the supplied data.frame
(field names are supplied as error.lower
and error.upper
arguments).
To change from arithmetic mean plus/minus standard deviation to the corresponding geometric parameters, set mean.type
argument from "arithmetic" to "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 in first place, 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.