Skip to content

Chord

chord() over named columns of a dataframe_mojo DataFrame (#743). Each argument names a column instead of holding the values.

Chord

Usage

from dataviz import chord
from dataviz import save
from dataviz import Theme

def main() raises:
    # Illustrative hours contributed between teams during one quarter.
    # Repeated teams reveal both hubs and smaller cross-team exchanges.
    var from_teams: List[String] = [
        "Product", "Product", "Platform", "Platform", "Data", "Data",
        "Sales", "Support", "Security", "Security", "Support", "Sales",
    ]
    var to_teams: List[String] = [
        "Platform", "Data", "Security", "Support", "Product", "Sales",
        "Product", "Platform", "Product", "Data", "Sales", "Support",
    ]
    var collaboration_hours: List[Int] = [
        180, 125, 150, 95, 110, 70, 135, 105, 80, 55, 65, 45,
    ]

    var c = chord(
        from_teams,
        to_teams,
        collaboration_hours,
        title="Illustrative Cross-Team Project Hours",
    )
    save(c, "docs/src/examples/out_chord.svg")

See Data shapes for shared input conventions.

Args:

  • df: The frame to read.
  • from_categories: The string column for this channel.
  • to_categories: The string column for this channel.
  • values: The numeric column for this channel.
  • ring_fraction: See the list overload.
  • theme: See the list overload.
  • width: See the list overload.
  • height: See the list overload.
  • title: See the list overload.
  • subtitle: See the list overload.
  • x_title: See the list overload.
  • y_title: See the list overload.

Related

Related charts: Arc Diagram

Relevant API: chord