Streamgraph
Streamgraph
A streamgraph.
Usage
from dataviz_mojo import streamgraph
from dataviz_mojo.plot import save
def main() raises:
var years: List[String] = ["2020", "2021", "2022", "2023", "2024"]
var genres: List[String] = ["Pop", "Rock", "Jazz"]
var listens: List[List[Float64]] = [
[30.0, 40.0, 55.0, 60.0, 50.0],
[45.0, 35.0, 30.0, 25.0, 20.0],
[10.0, 15.0, 12.0, 18.0, 25.0],
]
var c = streamgraph(years, genres, listens)
save(c, "docs/src/examples/out_streamgraph.svg")Args:
categories: One position along the x-axis per entry, in the given order.series_names: One flowing band 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.smoothing: Setstheme.line_smoothing– how much each band’s edges curve,[0.0, 1.0]. Defaults to0.6, notTheme’s own0.0: a streamgraph is meant to look like flowing water, so unlikeMark.LINE/AREA(straight by default), this one curves unless told not to. Pass0.0for the old straight-segment bands.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.