plot_groupedbar {daltoolbox} | R Documentation |
Plot grouped bar
Description
This function generates a grouped bar plot from a given data frame using ggplot2.
Usage
plot_groupedbar(data, label_x = "", label_y = "", colors = NULL, alpha = 1)
Arguments
data |
data.frame contain x, value, and variable |
label_x |
x-axis label |
label_y |
y-axis label |
colors |
color vector |
alpha |
level of transparency |
Value
returns a ggplot graphic
Examples
#summarizing iris dataset
data <- iris |> dplyr::group_by(Species) |>
dplyr::summarize(Sepal.Length=mean(Sepal.Length), Sepal.Width=mean(Sepal.Width))
head(data)
#ploting data
grf <- plot_groupedbar(data, colors=c("blue", "red"))
plot(grf)
[Package daltoolbox version 1.2.707 Index]