A figure is a value.
viz.figure(title) and viz.scene3d(title) return records; each mark (line, band, histogram, heatmap, surface…) appends a series. Named and default arguments keep calls short.
Ostrin Viz 0.1
std.viz is the visualization library of the Ostrin standard library, written in Ostrin itself. A figure is data (a list of series); rendering it lays out ticks, legends, colormaps and 3D projections and writes a standalone SVG. The interpreter, the native C backend and the compiler running in this page produce the same bytes.
viz.figure(title) and viz.scene3d(title) return records; each mark (line, band, histogram, heatmap, surface…) appends a series. Named and default arguments keep calls short.
1-2-5 ticks, legends placed in the emptiest corner, marching-squares contours, an orthographic camera, painter's algorithm and directional light: all of it is Ostrin code.
fig.svg() returns the document and fig.save(path) writes it. Units travel with the data: plotting Array<Quantity<D>> labels the axes speed [km/h].
import std.viz
fn main() -> Void {
times = [0 s, 5 s, 10 s, 15 s, 20 s]
speeds = [0 m/s, 6.1 m/s, 11.4 m/s, 15.8 m/s, 19.4 m/s]
in_kmh = speeds.map(fn(v) { v as km/h })
fig = viz.figure("Car acceleration")
.labels("time", "speed")
.unit_line(times, in_kmh, label: "measured")
print(fig.svg()) // axes: "time [s]" and "speed [km/h]"
}Featured workflows
These guided paths reuse the same source-backed figures below. Select a path to share it with ?workflow=..., then open its plot, table, animation or provenance record.
Gallery
Each image below is the SVG its program printed when this site was built with ostrinc.wasm. Press Run live to recompute it in this page. Explore a figure and copy its URL to share the selected parameters or 3D camera. Download its small ostrin.figure/v0 manifest to keep the source link, artifact path, capability tags, recorded provenance and current explorer state together, or open Cite for a BibTeX handoff with that same URL. All 30 bundle-backed gallery figures now offer a versioned ostrin.experiment/v0 download with declared inputs, calculated hashes and exact SVG replay verified in website CI; each bundle also records a partial ostrin.runtime/v1 target/WASI snapshot, available lockfile hashes and the verified invocation hash for its SVG. All eleven input-driven bundles now carry embedded input snapshots and declared filesystem capabilities, so their parameter or seed replays are labelled R2; the nine seeded bundles retain source-backed R1 algorithm evidence. The remaining 18 bundles stay at R0. The three polished figures (viz_polished_*) are recorded SVG cards without an experiment bundle yet.
Recorded SVGs load immediately. The browser compiler starts only when you choose Run live or open an interactive explorer.
Evidence map
Filter the recorded gallery by the artifact each Ostrin program produces. Counts come from the source and SVG metadata generated for this page. Each filter has a shareable ?capability=... URL.
Status
Current limits: rendering is CPU-side SVG, comfortable up to a few thousand triangles.