Skip to content
Area

Area

An area chart.

Area

Usage

from std.math import sin

from dataviz_mojo import area
from dataviz_mojo.plot import save
from dataviz_mojo.colors import STEELBLUE
from dataviz_mojo.theme import Theme

def main() raises:
    var x = List[Float64]()
    var y = List[Float64]()
    for i in range(30):
        var t = Float64(i) * 0.3
        x.append(t)
        y.append(sin(t) * 4.0 + 6.0)

    var c = area(x, y, theme=Theme(mark_color=STEELBLUE))
    save(c, "docs/src/examples/out_area.svg")

Args:

  • x: The continuous x column, one entry per point.
  • y: The continuous y column; the filled area runs from each point down to zero.
  • 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.
  • x_title: The x-axis caption.
  • y_title: The y-axis caption.