This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

Plotting

plot prints a structured record, and the page draws the chart from it. Run a cell to see its output beside the expected one.

plot emits a structured record

figure declares the chart (title, x label, y label) and plot adds a series. Both print records on stdout; the page draws the chart from them and adds nothing of its own.

Viv [1]

A matrix as a heatmap with plot2d

plot2d(Z) or plot2d(Z, "label") renders a rank-2 array as a color map (viridis) with a colorbar. The format of the printed record is fixed, and this example's test fails if it changes.

Viv [2]

A curve in three dimensions with plot3d

plot3d(x, y, z, "label") draws a rotatable 3-D curve — drag the rendered figure to spin it. Three equal-length rank-1 arrays.

Viv [3]

A histogram

histogram counts into equal bins; bars draws the counts at the bin centers. A plot on the same x afterwards draws a curve over the bars, which is how a measured distribution is shown against a theoretical one.

Viv [4]

Same x merges into one chart

Consecutive plots sharing an x-array become labeled series on one figure.

Viv [5]

Different x means different charts

Each chart gets its own figure.

Viv [6]

figure is required

A chart's title and axis labels are part of the program. Nothing outside it can add them, so a plot with no figure declared does not compile — in any engine.

Viv [7]

expected error: needs a `figure(title, xlabel, ylabel)` before it…