Skip to content
Chord

Chord

A chord diagram.

Chord

Usage

from dataviz_mojo import chord
from dataviz_mojo.plot import save
from dataviz_mojo.theme import Theme

def main() raises:
    var from_regions: List[String] = ["North", "North", "South", "East", "West"]
    var to_regions: List[String] = ["South", "East", "West", "West", "North"]
    var trade_volume: List[Float64] = [12.0, 8.0, 15.0, 6.0, 10.0]

    var c = chord(from_regions, to_regions, trade_volume)
    save(c, "docs/src/examples/out_chord.svg")

Args:

  • from_categories: Each flow’s source node, one entry per row.
  • to_categories: Each flow’s destination node, one entry per row (paired with from_categories[i]).
  • values: Each flow’s magnitude, sizing its ribbon; must be non-negative.
  • 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.