plot_boxplot.Rd
Wrapper around [ggplot2::geom_boxplot()] that plots pretty boxplots using a custom ggplot theme.
plot_boxplot(
data,
x_str = NULL,
y_str = NULL,
fill_str = NULL,
horizontal = FALSE,
theme_options = NULL,
show_plot = FALSE,
...
)
Data frame to use for plot.
Character string. Name of variable in data
to plot on
x-axis. If NULL
, plot boxplot using all values in data frame.
Character string (optional). Name of variable in data
to
plot on y-axis. Should be a factor variable.
Character string (optional). Name of variable in data
to use as fill aesthetic in plot.
Logical. Whether the boxplots should be horizontal instead of vertical.
(Optional) list of arguments to pass to vthemes::theme_vmodern().
Logical. Should this plot be printed? Default FALSE
.
Other arguments to pass to [ggplot2::geom_boxplot()].
A ggplot boxplot.
Other pretty_ggplot_wrappers:
plot_bar()
,
plot_density()
,
plot_histogram()
,
plot_line()
,
plot_point()
## plot boxplot of all data in data frame
plot_boxplot(as.data.frame(matrix(rnorm(1000), nrow = 100)))
## plot boxplot of single column in data frame
plot_boxplot(iris, y_str = "Sepal.Width")
plot_boxplot(iris, x_str = "Species", y_str = "Sepal.Width")
iris2 <- data.frame(iris,
z = as.factor(rep(letters[1:2],
length.out = nrow(iris))))
plot_boxplot(iris2, x_str = "Species", y_str = "Sepal.Width", fill_str = "z")
plot_boxplot(iris2, y_str = "Sepal.Width", fill_str = "z")