cheatah
Module

series

cheatah-plot v0.1.0-alpha — Biome Standard 0.6.3-alpha

Classes

Functions

fn Series blank(builtins::Value auto &&kind) #

The neutral Series every constructor starts from: empty arrays, auto colour, house widths, solid stroke, no marker, no label, filled — ONE place the defaults live.

Parameters
kind

the mark kind the constructor is building.

Returns

the neutral Series with kind set.

Complexity

O(1).

Allocation

the Series (empty arrays).

System testsystests/test_series.purr
Example
import plot.series as series
let s = series.blank("line")
s.width = 2.5   # -> start from the house defaults, restyle what differs
fn inline ::cheatah::ndarray::basic_ndarray< double > dash_pattern(builtins::Value auto &&on, builtins::Value auto &&off) #

A dash pattern from on/off pixel lengths — the common two-segment pattern (pass it to the _styled constructors; an empty dash array means solid).

Parameters
on

the drawn segment length in pixels (> 0).

off

the gap length in pixels (> 0).

Returns

the two-element dash array [on, off].

Complexity

O(1).

Allocation

the returned array.

System testsystests/test_series.purr
Example
import plot.series as series
import plot.color as color
import ndarray
let x = ndarray.array([0.0, 1.0, 2.0])
let y = ndarray.array([1.0, 0.0, 1.0])
let d = series.dash_pattern(6.0, 3.0)
let c = color.auto_color()
let s = series.line_styled(x, y, c, 1.5, d, "")   # -> a 6-on/3-off dashed line
fn Series line(::cheatah::ndarray::basic_ndarray< double > &x, ::cheatah::ndarray::basic_ndarray< double > &y) #

A line through (x, y) with the house defaults (auto colour, width 1.5, solid).

Parameters
x

the x positions.

y

the y values (same length).

Returns

the line Series.

Complexity

O(1) — the arrays are shared, not copied.

Allocation

the Series.

System testsystests/test_series.purr
Example
import plot.series as series
import ndarray
let x = ndarray.array([0.0, 1.0, 2.0, 3.0])
let y = ndarray.array([0.0, 1.0, 4.0, 9.0])
let s = series.line(x, y)   # -> a house-default line through the four points
fn Series line_styled(::cheatah::ndarray::basic_ndarray< double > &x, ::cheatah::ndarray::basic_ndarray< double > &y, plot::color::Color &c, builtins::Value auto &&width, ::cheatah::ndarray::basic_ndarray< double > &dash, builtins::Value auto &&label) #

A line with the full style set: colour, width, dash pattern, legend label.

Parameters
x

the x positions.

y

the y values (same length).

c

the line colour (alpha 0 = auto).

width

the line width in pixels.

dash

the dash pattern [on, off, ...]; empty = solid.

label

the legend label ("" = unlabeled).

Returns

the styled line Series.

Complexity

O(1) — the arrays are shared, not copied.

Allocation

the Series.

System testsystests/test_series.purr
Example
import plot.series as series
import plot.color as color
import ndarray
let x = ndarray.array([0.0, 1.0, 2.0, 3.0])
let y = ndarray.array([0.0, 2.0, 1.0, 3.0])
let c = color.named("crimson")
let solid = ndarray.zeros([0])
let s = series.line_styled(x, y, c, 2.0, solid, "loss")   # -> a bold labeled line
fn Series scatter(::cheatah::ndarray::basic_ndarray< double > &x, ::cheatah::ndarray::basic_ndarray< double > &y) #

Scatter points at (x, y) with the house defaults (auto colour, size 6, circle markers).

Parameters
x

the x positions.

y

the y values (same length).

Returns

the scatter Series.

Complexity

O(1) — the arrays are shared, not copied.

Allocation

the Series.

System testsystests/test_series.purr
Example
import plot.series as series
import ndarray
let x = ndarray.array([1.0, 2.0, 3.0, 4.0])
let y = ndarray.array([2.1, 3.9, 6.2, 7.8])
let s = series.scatter(x, y)   # -> circle markers at the four points
fn Series scatter_styled(::cheatah::ndarray::basic_ndarray< double > &x, ::cheatah::ndarray::basic_ndarray< double > &y, plot::color::Color &c, builtins::Value auto &&size, builtins::Value auto &&marker, builtins::Value auto &&label) #

Scatter with the full style set: colour, marker size and shape, legend label.

Parameters
x

the x positions.

y

the y values (same length).

c

the marker colour (alpha 0 = auto).

size

the marker size in pixels.

marker

the marker shape: "circle" | "square" | "diamond".

label

the legend label ("" = unlabeled).

Returns

the styled scatter Series.

Complexity

O(1) — the arrays are shared, not copied.

Allocation

the Series.

System testsystests/test_series.purr
Example
import plot.series as series
import plot.color as color
import ndarray
let x = ndarray.array([1.0, 2.0, 3.0])
let y = ndarray.array([2.0, 1.0, 3.0])
let c = color.named("teal")
let s = series.scatter_styled(x, y, c, 9.0, "diamond", "runs")   # -> big teal diamonds
fn Series scatter_grouped(::cheatah::ndarray::basic_ndarray< double > &x, ::cheatah::ndarray::basic_ndarray< double > &y, builtins::Value auto &&by) #

Scatter with per-point group ids: points in the same group share a palette colour, and each group can take its own legend entry at the figure layer.

Parameters
x

the x positions.

y

the y values (same length).

by

the per-point group ids (same length; small non-negative ints).

Returns

the grouped scatter Series.

Complexity

O(1) — the arrays are shared, not copied.

Allocation

the Series.

System testsystests/test_series.purr
Example
import plot.series as series
import ndarray
let x = ndarray.array([0.0, 1.0, 2.0, 3.0])
let y = ndarray.array([1.0, 2.0, 1.5, 3.0])
let groups = [0, 0, 1, 1]
let s = series.scatter_grouped(x, y, groups)   # -> one palette colour per group
fn Series bar(::cheatah::ndarray::basic_ndarray< double > &x, ::cheatah::ndarray::basic_ndarray< double > &y) #

Vertical bars at x with heights y, the house defaults (auto colour, 0.8 slot fraction, filled).

Parameters
x

the bar positions (typically category centers).

y

the bar heights (same length).

Returns

the bar Series.

Complexity

O(1) — the arrays are shared, not copied.

Allocation

the Series.

System testsystests/test_series.purr
Example
import plot.series as series
import ndarray
let x = ndarray.array([0.0, 1.0, 2.0])
let counts = ndarray.array([4.0, 7.0, 2.0])
let s = series.bar(x, counts)   # -> three bars, each 0.8 of its slot wide
fn Series bar_styled(::cheatah::ndarray::basic_ndarray< double > &x, ::cheatah::ndarray::basic_ndarray< double > &y, plot::color::Color &c, builtins::Value auto &&width, builtins::Value auto &&fill, builtins::Value auto &&label) #

Bars with the full style set: colour, slot-fraction width, fill vs outline, legend label.

Parameters
x

the bar positions.

y

the bar heights (same length).

c

the bar colour (alpha 0 = auto).

width

the bar width as a fraction of one slot (0..1].

fill

true = filled bars, false = outlines.

label

the legend label ("" = unlabeled).

Returns

the styled bar Series.

Complexity

O(1) — the arrays are shared, not copied.

Allocation

the Series.

System testsystests/test_series.purr
Example
import plot.series as series
import plot.color as color
import ndarray
let x = ndarray.array([0.0, 1.0, 2.0])
let y = ndarray.array([3.0, 5.0, 4.0])
let c = color.named("steelblue")
let s = series.bar_styled(x, y, c, 0.6, true, "2026")   # -> slim filled labeled bars
fn Series area(::cheatah::ndarray::basic_ndarray< double > &x, ::cheatah::ndarray::basic_ndarray< double > &y) #

A filled area between y and the x axis (auto colour).

Parameters
x

the x positions.

y

the top edge values (same length).

Returns

the area Series.

Complexity

O(1) — the arrays are shared, not copied.

Allocation

the Series.

System testsystests/test_series.purr
Example
import plot.series as series
import ndarray
let x = ndarray.array([0.0, 1.0, 2.0, 3.0])
let y = ndarray.array([0.5, 1.5, 1.0, 2.0])
let s = series.area(x, y)   # -> the region under the curve, filled to the axis
fn Series step(::cheatah::ndarray::basic_ndarray< double > &x, ::cheatah::ndarray::basic_ndarray< double > &y) #

A step line through (x, y): each value holds until the next x (auto colour, width 1.5).

Parameters
x

the x positions.

y

the y values (same length).

Returns

the step Series.

Complexity

O(1) — the arrays are shared, not copied.

Allocation

the Series.

System testsystests/test_series.purr
Example
import plot.series as series
import ndarray
let x = ndarray.array([0.0, 1.0, 2.0, 3.0])
let y = ndarray.array([1.0, 3.0, 2.0, 2.5])
let s = series.step(x, y)   # -> each value holds until the next x
fn Series errorbar(::cheatah::ndarray::basic_ndarray< double > &x, ::cheatah::ndarray::basic_ndarray< double > &y, ::cheatah::ndarray::basic_ndarray< double > &ylo, ::cheatah::ndarray::basic_ndarray< double > &yhi) #

Points with asymmetric error bars: whiskers span [ylo, yhi] at each x.

Parameters
x

the x positions.

y

the central values (same length).

ylo

the lower whisker ends (absolute values, same length).

yhi

the upper whisker ends (absolute values, same length).

Returns

the errorbar Series.

Complexity

O(1) — the arrays are shared, not copied.

Allocation

the Series.

System testsystests/test_series.purr
Example
import plot.series as series
import ndarray
let x = ndarray.array([0.0, 1.0, 2.0])
let y = ndarray.array([2.0, 3.0, 2.5])
let ylo = ndarray.array([1.7, 2.6, 2.2])
let yhi = ndarray.array([2.3, 3.4, 2.8])
let s = series.errorbar(x, y, ylo, yhi)   # -> whiskers spanning [ylo, yhi]
fn Series fill_between(::cheatah::ndarray::basic_ndarray< double > &x, ::cheatah::ndarray::basic_ndarray< double > &ylo, ::cheatah::ndarray::basic_ndarray< double > &yhi) #

A filled band between two curves: [ylo, yhi] at each x (auto colour).

Parameters
x

the x positions.

ylo

the band's lower edge (same length).

yhi

the band's upper edge (same length).

Returns

the fill_between Series.

Complexity

O(1) — the arrays are shared, not copied.

Allocation

the Series.

System testsystests/test_series.purr
Example
import plot.series as series
import ndarray
let x = ndarray.array([0.0, 1.0, 2.0])
let ylo = ndarray.array([0.5, 1.0, 0.8])
let yhi = ndarray.array([1.5, 2.2, 1.9])
let s = series.fill_between(x, ylo, yhi)   # -> a filled confidence-style band
fn Series stem(::cheatah::ndarray::basic_ndarray< double > &x, ::cheatah::ndarray::basic_ndarray< double > &y) #

Stems: a vertical line from the x axis to each (x, y), topped with a marker.

Parameters
x

the x positions.

y

the stem heights (same length).

Returns

the stem Series.

Complexity

O(1) — the arrays are shared, not copied.

Allocation

the Series.

System testsystests/test_series.purr
Example
import plot.series as series
import ndarray
let x = ndarray.array([0.0, 1.0, 2.0, 3.0])
let y = ndarray.array([1.0, -0.5, 2.0, 0.75])
let s = series.stem(x, y)   # -> circle-topped stems rising or dropping from the axis
fn Series heatmap(::cheatah::ndarray::basic_ndarray< double > &z) #

A heatmap of a row-major 2-D grid: cell (row, col) is coloured by z through a colormap at the figure layer.

Parameters
z

the 2-D value grid (row-major ndarray, shape [rows, cols]).

Returns

the heatmap Series.

Complexity

O(1) — the grid is shared, not copied.

Allocation

the Series.

System testsystests/test_series.purr
Example
import plot.series as series
import ndarray
let flat = ndarray.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])
let z = ndarray.reshape(flat, [2, 3])
let s = series.heatmap(z)   # -> a 2x3 grid, coloured through the figure's colormap
fn const char * module_abi() noexcept #

ABI/identity marker for the series cheatah module: returns the module name.

Auto-emitted by purrc's library emitter. It is the concrete symbol that anchors the module's signed static archive in opaque (source-hidden) builds.

Returns

the module name ("series").