Skip to content
Span Chart

Span Chart

A span chart.

Span Chart

Usage

from dataviz_mojo import span_chart
from dataviz_mojo.plot import save

def main() raises:
    var months: List[String] = [
        "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
    ]
    var temp_low: List[Float64] = [-3.0, -2.0, 3.0, 10.0, 15.0, 19.0, 21.0, 20.0, 15.0, 8.0, 2.0, -1.0]
    var temp_high: List[Float64] = [5.0, 7.0, 12.0, 20.0, 25.0, 29.0, 31.0, 30.0, 26.0, 18.0, 10.0, 5.0]

    var c = span_chart(months, temp_low, temp_high)
    save(c, "docs/src/examples/out_span_chart.svg")

Args:

  • categories: One floating vertical bar per entry, in the given order.
  • low: Each bar’s lower value.
  • high: Each bar’s upper 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.