lichtung-plot
A standalone, strongly typed scientific renderer for owned immutable display values. The crate provides 25 scientific plot families, themes, facets, named Canvas panels, native layout reports and local image composition. Complete editable Recipe declarations adopt named memory or local file inputs.
It has no dependency on another lichtung-* crate. Callers supply native values
and precomputed inferential annotations; the renderer does not run application
analysis, access the network or provision assets.
First Plot
use ;
scatter
.svg?; // Publishes scatter.svg.
# Ok::
The public API is documented on docs.rs.
Specialized values are organized by function: for example
coordinates::AxisTick, scales::AlphaEncoding, theme::TextTheme and
output::PngOptions. Both adapters use the same native relative paths.
English and
Chinese user guides and
architectural specifications
are maintained at the workspace root, not copied into this package.
Output And Fonts
Plot and Canvas derive dimensions from their content by default. Explicit
width, max_width and size requests control the canonical figure dimensions.
Terminal methods borrow the configuration and return an opaque frozen Output;
each call renders anew. Output clones share one scene and remain usable after
publication failure; further SVG or PNG publication
uses that same scene without repeating scientific preparation, font discovery or
layout. SVG methods append .svg and PNG methods append .png unless the final
filename already has the matching suffix.
output::Format selects outlined SVG, preserve-text SVG or PNG for
save_with, encode and write_to. The same frozen scene supports native
region references and tight bounds, pixel buffers and borrowed pixel storage.
composition::ImageAsset and Placement place local SVG/PNG content or
native frozen pictures without repeating the base preparation.
The renderer resolves installed system fonts and never downloads or embeds font files. Its default ordered font stack is:
Noto Sans, Noto Sans CJK SC, DejaVu Sans, Liberation Sans, Arial, sans-serif
Outlined SVG and PNG do not require those fonts at viewing time. Preserve-text SVG keeps selectable text and depends on the viewer's installed fonts. Generation requires installed fonts covering the requested text in either case.
Recipes
get_recipe extracts the actual input requirements and editable
configuration; recipe(path) writes that same declaration to TOML.
The core can build or check a Recipe using named memory inputs or local
CSV, TSV, JSON, NPY, NPZ and Parquet files. Full, style and fillable-layout
scopes support reuse of a figure, its appearance or its grid.
BindingRequirement reports the actual original selections and related
shapes. See the shared
recipe contract
for the common format and examples.
The separately distributable lichtung-plot-cli package exposes the
same native Recipe, font, composition and publication operations as the
lichtung-plot command. The core has no dependency on that package.
Examples And Development
The package includes runnable examples and self-contained default test fixtures. For example, from the workspace root or this package directory:
Examples run without arguments and write to the working directory. An optional
directory after -- redirects output and is created if needed. This example
writes quick_start.svg. The
workspace pins Rust 1.96.0 and maintains the shared lockfile. Root Justfile
recipes validate the whole workspace; use -p lichtung-plot for focused Cargo
commands. Complete Unicode conformance checks are opt-in and require explicit
external sources; they are not part of default test execution.
Licensed under MIT OR Apache-2.0; both license texts are included in this package.