plot_bar.RdWrapper around [ggplot2::geom_bar()] that plots pretty bar plots using a custom ggplot theme.
plot_bar(
data,
x_str,
y_str = NULL,
fill_str = NULL,
fill = "#6FBBE3",
stat = "count",
position = "dodge",
theme_options = NULL,
show_plot = FALSE,
...
)Data frame to use for plot.
Character string. Name of variable in data to plot on
x-axis.
Character string. Name of variable in data to plot on
y-axis. Used only if stat = "identity".
Character string (optional). Name of variable in data
to use as fill aesthetic in plot.
Fill color. Used only if fill_str is NULL.
Override the default connection between geom_bar() and
stat_count().
Position adjustment, either as a string, or the result of a call to a position adjustment function.
(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_bar()].
A ggplot bar plot.
Other pretty_ggplot_wrappers:
plot_boxplot(),
plot_density(),
plot_histogram(),
plot_line(),
plot_point()
df <- data.frame(x = rep(letters[1:3], 2), y = rep(LETTERS[1:2], 3))
plot_bar(data = df, x_str = "x")
plot_bar(df, x_str = "x", fill_str = "y")