Runnable sheets provide a built-in plot() function injected into every cell's namespace. No import is needed. Each call produces a line-plot panel rendered directly below the cell output.
plot(y) # single series, x = 0, 1, 2, ...
plot(x, y) # single series, explicit x
plot(x, y1, y2, ...) # multiple series, shared x
# Keyword arguments (all optional):
plot(y, title='My plot', x_label='time', y_label='value')
title — string displayed above the plot (default: 'Plot').
x_label — x-axis label (default: 'x').
y_label — y-axis label (default: 'y').
import math
y = [math.sin(i * 0.3) for i in range(30)]
plot(y, title='Sine wave', y_label='sin(x)')
x = [i * 0.2 for i in range(40)]
y = [math.exp(-0.1 * v) * math.cos(v) for v in x]
plot(x, y, title='Damped cosine', x_label='t', y_label='amplitude')
With 3+ arguments where the first two have equal length, the first argument is treated as x and the rest as y-series.
x = [i * 0.25 for i in range(32)]
y1 = [math.sin(v) for v in x]
y2 = [math.cos(v) for v in x]
plot(x, y1, y2, title='sin and cos', x_label='radians')
Each plot() call in a cell appends a separate panel below the cell, in call order.
plot([1, 4, 9, 16, 25], title='Squares')
plot([1, 2, 6, 24, 120], title='Factorials')
The function accepts any numeric iterable: list, tuple, range, generator expressions, or numpy arrays. Scalars are wrapped in a one-element list automatically.
All values must be finite real numbers. Non-numeric values and infinities raise TypeError or ValueError immediately.
With exactly two arguments, plot(a, b) always means x=a, y=b — it never means two y-series. If len(a) != len(b) a ValueError is raised. To plot two y-series against a shared x, use three arguments: plot(x, y1, y2).
Plots are rendered as native wx panels using custom drawing (no matplotlib dependency). Features:
• Title centred above the plot area
• x and y axis labels
• Auto-scaled axes with min/max tick values shown
• Horizontal gridlines
• Fixed panel height (250px); width tracks window width
• Multiple series are drawn in distinct colours cycling through blue, red, green, purple (matplotlib C0–C3 palette)
plot() returns the plot spec dict ({"kind": "plot", "title": ..., "series": [...], ...}). This can be ignored or inspected/serialised if needed.
A runnable test sheet covering all signatures lives at runnable-scripts/plot-test.