Skip to content
Beeswarm

Beeswarm

A beeswarm plot.

Beeswarm

Usage

from dataviz_mojo import beeswarm
from dataviz_mojo.plot import save

def main() raises:
    var classes: List[String] = ["Section A", "Section B", "Section C"]
    var scores: List[List[Float64]] = [
        [72.0, 75.0, 78.0, 80.0, 74.0, 76.0, 91.0],
        [65.0, 70.0, 72.0, 88.0, 90.0, 92.0, 95.0],
        [80.0, 82.0, 83.0, 84.0, 81.0, 79.0, 85.0],
    ]

    var c = beeswarm(classes, scores)
    save(c, "docs/src/examples/out_beeswarm.svg")

Args:

  • categories: One swarm per entry, in the given order.
  • values: Each category’s raw values (values[i], not a summary statistic) – one point drawn per value.
  • theme: Full styling knobs beyond this function’s own parameters (colors, margins, fonts, gridlines, …) – see Theme’s docstring.
  • width: Pixel width of the returned Plot (.size()).
  • height: Pixel height of the returned Plot (.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.