plot

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package plot is a require()-able host module that turns numeric data into standalone SVG charts — the "see your data" half of a data-science loop. It has no external dependencies: charts are rendered by hand to an SVG string that any browser or image viewer can open, and can be written straight to a .svg file.

The central object is a Figure, which accumulates one or more series and renders them onto shared, auto-ranged axes:

local plot = require("plot")
local fig = plot.figure({ title = "demo", xlabel = "x", ylabel = "y" })
fig:line({1,2,3,4}, {1,4,9,16}, { label = "sq", color = "#e15759" })
fig:scatter({1,2,3,4}, {2,3,5,7}, { label = "obs" })
fig:save("demo.svg")

Convenience one-liners build a single-series figure directly:

plot.line({1,2,3}, {2,4,6}):save("line.svg")
plot.histogram({1,1,2,3,3,3,4}, 4):save("hist.svg")

Charts render on an explicit white background with dark axes so they read correctly regardless of the viewer's theme.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterPlotPreload

func RegisterPlotPreload(v *vm.VM)

RegisterPlotPreload installs the loader under package.preload.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL