plot_groupedbar: Plot grouped bar

View source: R/graphics.R

plot_groupedbarR Documentation

Plot grouped bar

Description

Grouped (side‑by‑side) bar chart for multiple series per category.

Usage

plot_groupedbar(data, label_x = "", label_y = "", colors = NULL, alpha = 1)

Arguments

data

data.frame with category in first column and series in remaining columns

label_x

x‑axis label

label_y

y‑axis label

colors

optional vector of fill colors, one per series

alpha

bar transparency (0–1)

Details

Expects a data.frame where the first column is the category (x) and the remaining columns are numeric series. Bars are grouped by series. Provide colors with length equal to the number of series to set fills.

Value

returns a ggplot2::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)

daltoolbox documentation built on Nov. 5, 2025, 7:09 p.m.