lmplot

lmplot is gnuplot packaged as a single self-contained executable and LMScript host with embedded DejaVu fonts and a deterministic PNG/SVG rasterizer. It renders 2D and 3D plots, surfaces, contours, heat maps, fits, and dashboards without X11, Cairo, or libgd.

Quick reference

npm install -g @lmctl-ai/lmctl
lmplot --version
lmplot --lmcode-schema --json
lmplot gnuplot -e "set terminal png size 800,500; set output 'sin.png'; plot sin(x) lw 2"
Method or commandSignature or syntaxPurpose
plot.png / plot.svg / plot.closeplot.png(file, w, h), plot.svg(file, w, h), plot.close()Open a deterministic PNG or SVG canvas at width x height pixels and flush/close it after plotting.
plot.cmd / plot.script / plot.loadplot.cmd(line), plot.script(text), plot.load(file)Execute single-line gnuplot commands, multi-line gnuplot scripts, or external .gp files.
plot.dataplot.data(name, text)Define an in-memory gnuplot datablock $name from a string with a collision-safe terminator.
plot.num / plot.str / plot.assert_closeplot.num(expr) -> float, plot.str(expr) -> string, plot.assert_close(a, b, tol)Read gnuplot stats, fit, and GPVAL_* variables back into LMScript and verify tolerances.
lmplot gnuplotlmplot gnuplot -e "..." | script.gpRun the complete headless gnuplot CLI directly from the shell.
mkdir("images");
p = _lmcode_ cli="lmplot" install="github:lmctl-ai/lmplot@v0.3.1";
plot.png("images/sine.png", 800, 500);
plot.cmd("set title 'sin(x) and a cubic fit'");
plot.cmd("plot sin(x) lw 2, x - x**3/6.0 dt 2");
plot.close();
end _lmcode_
r = run_lmcode(p);
assert(r.ok, json_stringify(r));

Run in the browser

lmplot also builds to WebAssembly. The browser demo runs all 45 standalone examples inside the page. gnuplot, the lmcode virtual machine and the 13 Plot functions are one fixed host, lmplot.wasm (4.6 MB), written once as systems code in C and C++. Each example is application code: a few kilobytes of lmcode bytecode the page loads at run time, so a new plot never needs a new wasm build.

Radial-velocity curve with a Keplerian fit and residual panel, rendered by lmplot.wasm
examples/kepler_rv_fit.lms, rendered by lmplot.wasm in a browser tab from 7.6 KB of bytecode.
scripts/build-web.sh build-site

Documentation pages

Source repository and releases