Grouped Bar
Grouped Bar
A grouped bar chart.
Usage
from dataviz_mojo import grouped_bar
from dataviz_mojo.plot import save
def main() raises:
var quarters: List[String] = ["Q1", "Q2", "Q3", "Q4"]
var series_names: List[String] = ["North", "South", "East"]
var values: List[List[Float64]] = [
[42.0, 48.0, 45.0, 61.0],
[30.0, 35.0, 33.0, 40.0],
[55.0, 50.0, 58.0, 66.0],
]
var c = grouped_bar(
quarters,
series_names,
values,
title="Quarterly Revenue by Region",
x_title="Quarter",
y_title="Revenue ($M)",
)
save(c, "docs/src/examples/out_grouped_bar.svg")Args:
categories: One group of side-by-side bars per entry, in the given order.series_names: One sub-bar per name, used as the legend key.values:values[j]isseries_names[j]’s value per category.theme: Full styling knobs beyond this function’s own parameters (colors, margins, fonts, gridlines, …) – seeTheme’s docstring.width: Pixel width of the returnedPlot(.size()).height: Pixel height of the returnedPlot(.size()).title: The chart’s title, shown above the plot.subtitle: A secondary line shown under the title.x_title: The x-axis caption.y_title: The y-axis caption.