Slope
Slope
A slope chart.
Usage
from dataviz_mojo import line
from dataviz_mojo.plot import save
from dataviz_mojo.theme import Theme
from dataviz_mojo.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,
theme=Theme(
mark_color=SEAGREEN,
line_width=3.0,
show_gridlines=False,
),
width=320,
height=420,
)
save(c, "docs/src/examples/out_slope.svg")Args:
x: The continuous x column, one entry per point.y: The continuous y column, one entry per point.theme: Full styling knobs beyond this function’s own parameters (colors, margins, fonts, gridlines, …) – seeTheme’s docstring.width: Pixel width of the returnedPlot(.size()).height: Pixel height of the returnedPlot(.size()).title: The chart’s title, shown above the plot.x_title: The x-axis caption.y_title: The y-axis caption.