Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Line Charts

Signature

sp.line(title, labels=None, values=None, *, variant="basic", series=None, **kwargs) -> Chart

Description

sp.line() is the unified entry point for the entire line-chart family. The variant keyword selects the rendering strategy — every other argument is shared across variants.

Variants

Parameters


Returns

Chart — object with .html property and .show() method.


Single series connecting ordered data points.

Variant "basic"Aliases "basic"Returns Chart
Preview

Several series sharing the same x-axis. Pass series=[(name, values), ...].

Variant "multi"Aliases "multi" / "multiline" / "multiple"Returns Chart
Preview

Step (staircase) line — ideal for piecewise-constant data. Use step_shape to control corner direction.

Variant "stepped"Aliases "stepped" / "step" / "hv" / "vh"Returns Chart
Preview

Catmull-Rom smoothed curve. spline_tension (0–1) controls how tight the curve hugs the points.

Variant "spline"Aliases "spline" / "smooth" / "curved"Returns Chart
Preview

Area chart — fills the region under the line. fill_opacity controls transparency; stack_fill=True stacks multiple series.

Variant "filled"Aliases "filled" / "area" / "fill"Returns Chart
Preview

Small inline chart — no axes, perfect for dashboards. spark_cols arranges multiple series in a grid.

Variant "sparkline"Aliases "sparkline" / "spark" / "tiny"Returns Chart
Preview

Custom stroke pattern. dash_pattern="8,4" means 8px on, 4px off. Use "2,3" for dotted.

Variant "dashed"Aliases "dashed" / "dotted" / "styled"Returns Chart
Preview

Line plot with prominent markers. marker_size (px) controls dot size; show_points=True is implicit.

Variant "connected_scatter"Aliases "connected_scatter" / "markers" / "lines+markers"Returns Chart
Preview

Line breaks where values exceed gap_threshold. Useful for time series with missing samples.

Variant "gapped"Aliases "gapped" / "gaps" / "missing"Returns Chart
Preview

Line + confidence/forecast band fusion: pass series as low/high pairs ([group1_low, group1_high, group2_low, group2_high, ...]) instead of single traces. Each group gets a shaded area between its two bounds, thin dashed edge lines, and a solid midline with markers — a forecast interval, min/max envelope or confidence band, natively.

Variant "band"Aliases "band" / "confidence_band" / "forecast" / "range_band"Returns Chart
Preview

Each segment is colored on a diverging scale by its own local slope, with a matching soft gradient fill beneath, automatic peak/trough callouts, and a glowing pulse on the latest point — momentum, read at a glance instead of computed by eye.

Variant "momentum"Aliases "momentum" / "slope_glow" / "trend_pulse"Returns Chart
Preview

Auto-segments the series into narrative chapters at its own significant turning points, shades each by net direction, and captions it with a plain-language badge — the chart writes its own headline instead of asking the reader to compute one. epoch_pos_color / epoch_neg_color / epoch_flat_color (hex ints) recolor the rising/falling/flat chapters.

Variant "epoch"Aliases "epoch" / "chapters" / "regime_bands"Returns Chart
Preview

Compares the series against its own ideal glidepath to a pace_target, shading ahead-of-pace and behind-of-pace stretches in different colors, then extrapolates the recent trend past the last real point to project whether it clears the target. pace_ahead_color / pace_behind_color recolor the comparison.

Variant "pace"Aliases "pace" / "pacing" / "glidepath" / "runway"Returns Chart
Preview