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 variableArgumentsDescription
lmplot --versionnonePrint lmplot X.Y.Z and exit 0.
lmplot --noticesnonePrint 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-signaturesnonePrint canonical context, function, and method signatures registered in the host.
lmplot --lmcodeFILE [--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_MBinteger (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_ASpng (default) or svgWith 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 / contextMethod signatureDescription
context plot: Plotplot.cmd(string) -> voidExecute a single gnuplot command line (semicolon-separated statements are supported).
Plotplot.script(string) -> voidWrite multi-line gnuplot text to a temporary file and execute it via load (supports inline datablocks and structured blocks).
Plotplot.load(string) -> voidExecute a gnuplot script file from disk (load "path").
Plotplot.data(string, string) -> voidDefine the in-memory gnuplot datablock $name (pass name without the leading $; must start with a letter).
Plotplot.png(string, int, int) -> voidSelect the deterministic built-in PNG terminal at width x height pixels and open the output file.
Plotplot.svg(string, int, int) -> voidSelect the SVG terminal at width x height pixels and open the output file.
Plotplot.close() -> voidRun set output to flush and close the current output file.
Plotplot.num(string) -> floatEvaluate a gnuplot numeric expression and return its float value (complex or array values fail with exit code 3; NaN returns NaN).
Plotplot.str(string) -> stringEvaluate a gnuplot expression and return its string value (numbers are formatted with %.15g).
Plotplot.terminals() -> stringReturn the space-separated list of built-in gnuplot terminals (GPVAL_TERMINALS).
Plotplot.echo(string) -> voidPrint a line to stdout.
Plotplot.version() -> stringReturn the lmplot version string (lmplot X.Y.Z).
Plotplot.assert_close(float, float, float) -> voidAssert |actual - expected| <= tol for finite numbers and non-negative tol; fails with exit code 3 on violation.

Built-in terminals and image inputs

FeatureSupported formats or optionsDescription
Raster terminalspng, pngcairoBuilt-in anti-aliased RGBA scanline rasterizer with embedded DejaVu Sans, Sans Bold, Serif, Sans Mono, and Symbol mapping.
Vector and TeX terminalssvg, canvas, postscript, eps, epslatex, pslatex, pstricks, context, cgm, emf, fig, hpgl, dxfStandard headless gnuplot vector, HTML5 canvas, CAD, and LaTeX terminals.
Text terminalsdumb, block, tek40xxASCII/UTF-8 terminal plots for console logs.
Image inputspng, jpg, gif (first frame), bmp, tga, pnmLoaded via set pixmap or plot ... binary filetype=png|jpg|gif with rgbimage / rgbalpha.

WebAssembly build files

FileBuilt byRole
lmplot.js, lmplot.wasmscripts/build-wasm.shThe host: factory createLmplot (MODULARIZE), main runs with --lmcode FILE; exported callMain, FS, ENV.
lmplot-runner.jsweb/runProgram(createLmplot, module, {program, files, output}) returns {code, frame, stdout, stderr, images}.
worker.jsweb/Message {id, program: URL or ArrayBuffer, output: svg or png}; reply {id, ok, code, frame, stdout, stderr, ms, images}.
examples/NAME.bin, examples.jsonscripts/precompile-examples.sh, scripts/build-site.pyPrecompiled 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.

CategoryFunctions, types, or signaturesDescription
Strings, math, and filesstr_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_linesStandard byte-string manipulation, numeric math helpers, base64/hex encoding, and UTF-8 file I/O.
Collections, JSON, and return framingIntList, 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_nullTyped containers, JSON parsing, template rendering, and structured LMCODE_RETURN payload builders.

Exit codes

Exit codePhaseMeaning
0successPlotting script, expression evaluation, and assertions succeeded.
2cliInvalid CLI flags, retired flag (--first, --last, --dry-run), or malformed invocation manifest metadata.
3load / runBytecode load error, gnuplot command error (gnuplot: <GPVAL_ERRMSG>), failed assert_close, output write error, or exceeded LMPLOT_MAX_MEMORY_MB.
4appApplication failure or inability to write the terminal LMCODE_RETURN result frame.