lmplot reference
Complete CLI flags, gnuplot passthrough usage, Plot schema methods, built-in terminals, standard lmcode_std_v3 catalog, and exit codes for lmplot.
CLI commands, flags, and environment variables
| Command, flag, or variable | Arguments | Description |
|---|---|---|
| lmplot --version | none | Print lmplot X.Y.Z and exit 0. |
| lmplot --notices | none | Print gnuplot, DejaVu font, stb_truetype, stb_image, and runtime license notices. |
| lmplot --lmcode-schema | [--json] | Print the embedded JSON schema for the lmplot host (identical bytes with or without --json). |
| lmplot --lmcode-signatures | none | Print canonical context, function, and method signatures registered in the host. |
| lmplot --lmcode | FILE [--lmcode FILE ...] | Load and execute one or more compiled LMScript bytecode files in a shared gnuplot session. |
| lmplot gnuplot | [gnuplot-options] [file.gp ...] | Run the full headless gnuplot command-line interface (such as -e "commands" or script files). |
| LMPLOT_MAX_MEMORY_MB | integer (default 4096; 2048 in the WebAssembly build) | Maximum total memory budget in MiB for gnuplot datablocks, arrays, voxel grids, and the PNG canvas. |
| LMPLOT_PNG_AS | png (default) or svg | With svg, plot.png(file, w, h) uses gnuplot's svg terminal with a white background and writes file with .png replaced by .svg. The browser build's default view; works natively too. |
Host schema methods (context plot: Plot)
| Type / context | Method signature | Description |
|---|---|---|
| context plot: Plot | plot.cmd(string) -> void | Execute a single gnuplot command line (semicolon-separated statements are supported). |
| Plot | plot.script(string) -> void | Write multi-line gnuplot text to a temporary file and execute it via load (supports inline datablocks and structured blocks). |
| Plot | plot.load(string) -> void | Execute a gnuplot script file from disk (load "path"). |
| Plot | plot.data(string, string) -> void | Define the in-memory gnuplot datablock $name (pass name without the leading $; must start with a letter). |
| Plot | plot.png(string, int, int) -> void | Select the deterministic built-in PNG terminal at width x height pixels and open the output file. |
| Plot | plot.svg(string, int, int) -> void | Select the SVG terminal at width x height pixels and open the output file. |
| Plot | plot.close() -> void | Run set output to flush and close the current output file. |
| Plot | plot.num(string) -> float | Evaluate a gnuplot numeric expression and return its float value (complex or array values fail with exit code 3; NaN returns NaN). |
| Plot | plot.str(string) -> string | Evaluate a gnuplot expression and return its string value (numbers are formatted with %.15g). |
| Plot | plot.terminals() -> string | Return the space-separated list of built-in gnuplot terminals (GPVAL_TERMINALS). |
| Plot | plot.echo(string) -> void | Print a line to stdout. |
| Plot | plot.version() -> string | Return the lmplot version string (lmplot X.Y.Z). |
| Plot | plot.assert_close(float, float, float) -> void | Assert |actual - expected| <= tol for finite numbers and non-negative tol; fails with exit code 3 on violation. |
Built-in terminals and image inputs
| Feature | Supported formats or options | Description |
|---|---|---|
| Raster terminals | png, pngcairo | Built-in anti-aliased RGBA scanline rasterizer with embedded DejaVu Sans, Sans Bold, Serif, Sans Mono, and Symbol mapping. |
| Vector and TeX terminals | svg, canvas, postscript, eps, epslatex, pslatex, pstricks, context, cgm, emf, fig, hpgl, dxf | Standard headless gnuplot vector, HTML5 canvas, CAD, and LaTeX terminals. |
| Text terminals | dumb, block, tek40xx | ASCII/UTF-8 terminal plots for console logs. |
| Image inputs | png, jpg, gif (first frame), bmp, tga, pnm | Loaded via set pixmap or plot ... binary filetype=png|jpg|gif with rgbimage / rgbalpha. |
WebAssembly build files
| File | Built by | Role |
|---|---|---|
| lmplot.js, lmplot.wasm | scripts/build-wasm.sh | The host: factory createLmplot (MODULARIZE), main runs with --lmcode FILE; exported callMain, FS, ENV. |
| lmplot-runner.js | web/ | runProgram(createLmplot, module, {program, files, output}) returns {code, frame, stdout, stderr, images}. |
| worker.js | web/ | Message {id, program: URL or ArrayBuffer, output: svg or png}; reply {id, ok, code, frame, stdout, stderr, ms, images}. |
| examples/NAME.bin, examples.json | scripts/precompile-examples.sh, scripts/build-site.py | Precompiled lmcode programs (DSLB v6) and the list of data files every run mounts under examples/data/. |
Standard lmcode_std_v3 catalog
The pinned catalog (cpp/std/lmcode-std.schema.json) has 206 canonical signatures and does not include the REST and CLI interfaces of newer catalogs.
| Category | Functions, types, or signatures | Description |
|---|---|---|
| Strings, math, and files | str_len, str_substr, str_find, str_contains, str_starts_with, str_ends_with, str_lower, str_upper, str_trim, str_replace, str_repeat, str_split, str_match, str_to_int, str_is_int, str_to_float, str_is_float, str_base64_encode, str_base64_decode, str_hex_encode, str_hex_decode, math_abs, math_min, math_max, math_floor, math_ceil, math_round, math_sqrt, math_pow, file_read, file_write, file_append, file_exists, file_lines | Standard byte-string manipulation, numeric math helpers, base64/hex encoding, and UTF-8 file I/O. |
| Collections, JSON, and return framing | IntList, FloatList, StrList, IntMap, FloatMap, StrMap, IntStack, FloatStack, StrStack, IntQueue, FloatQueue, StrQueue, IntPQ, FloatPQ, StrPQ, Json (json_parse, template_render), lmcode_return_set, lmcode_return_put, lmcode_return_put_null, lmcode_return_null | Typed containers, JSON parsing, template rendering, and structured LMCODE_RETURN payload builders. |
Exit codes
| Exit code | Phase | Meaning |
|---|---|---|
| 0 | success | Plotting script, expression evaluation, and assertions succeeded. |
| 2 | cli | Invalid CLI flags, retired flag (--first, --last, --dry-run), or malformed invocation manifest metadata. |
| 3 | load / run | Bytecode load error, gnuplot command error (gnuplot: <GPVAL_ERRMSG>), failed assert_close, output write error, or exceeded LMPLOT_MAX_MEMORY_MB. |
| 4 | app | Application failure or inability to write the terminal LMCODE_RETURN result frame. |