Ridgeline
Ridgeline
A ridgeline plot.
Usage
from dataviz_mojo import ridgeline
from dataviz_mojo.plot import save
def main() raises:
var months: List[String] = ["June", "July", "August", "September"]
var temps: List[List[Float64]] = [
[68.0, 70.0, 72.0, 74.0, 71.0, 69.0, 75.0, 73.0],
[78.0, 80.0, 82.0, 85.0, 79.0, 81.0, 83.0, 84.0],
[80.0, 82.0, 84.0, 86.0, 81.0, 83.0, 85.0, 87.0],
[70.0, 72.0, 74.0, 76.0, 71.0, 73.0, 75.0, 69.0],
]
var c = ridgeline(months, temps)
save(c, "docs/src/examples/out_ridgeline.svg")Args:
categories: One overlapping density row per entry, top to bottom.values: Each category’s raw values (values[i]) – the density estimate is computed from these, not passed in directly.bandwidth: Overrides every category’s Silverman’s-rule kernel-density bandwidth with one shared value; must be positive if given. Left at its default0.0, each category gets its own Silverman’s-rule bandwidth.scale_by_count:False(the default, ggplot2’sscale = "width") gives every category’s peak the same maximum width;True(scale = "area") additionally scales a category’s maximum width bysqrt(n_i / max(n)), so one built from fewer raw values draws visibly narrower.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.