Skip to content

Slope

A slope chart.

Slope

Usage

from dataviz import line
from dataviz import save
from dataviz import Theme
from dataviz.core.colors import SEAGREEN

def main() raises:
    # x=0.0 ("2023"), x=1.0 ("2024") -- revenue, in millions.
    var x: List[Float64] = [0.0, 1.0]
    var revenue: List[Float64] = [42.0, 61.0]

    var c = line(
        x,
        revenue,
        title="Revenue, 2023 to 2024",
        x_title="Year",
        y_title="Revenue ($M)",
        theme=Theme(
            mark_color=SEAGREEN,
            line_width=3.0,
            show_gridlines=False,
        ),
        width=320,
        height=420,
    )
    save(c, "docs/src/examples/out_slope.svg")

See Data shapes for shared input conventions.

Args:

  • df: The frame to read.
  • x: The numeric column for the x axis.
  • y: The numeric column for the y axis.
  • step: Step (stairs) interpolation; see the numeric overload.
  • theme: Full styling knobs beyond this function’s own parameters.
  • 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; defaults to x.
  • y_title: The y-axis caption; defaults to y.

Related

Related charts: Funnel · Bump

Relevant API: line