# Example using CO2 dataset
plot_bar(
CO2,
var = "Type",
by = "Treatment",
fill.lab = "Plant Type",
color.bar = c("lightblue","lightgreen"),
border.color = "black",
bar.width = 0.5,
text.size = 3,
label = c("Quebec","Mississippi")
)
# Example using diamonds dataset
plot_bar(
ggplot2::diamonds,
var = "cut",
by = "color",
y.lab = "Distribution (%)",
fill.lab = "Cut",
text.size = 2,
bar.width = 0.9,
color.bar = c("#a465db","steelblue","darkgreen","darkred","#fcba03")
)
# Simple bar plot without grouping
plot_bar(ggplot2::diamonds, var = "cut")
Run the code above in your browser using DataLab