Expand description
§Scientific communication reflects on the scientist, and your figures should carry the same rizzma as your ideas.









On docs.rs every cell above is a real canvas driven by this crate compiled to WebAssembly — animated from Rust each frame, and interactive: wheel to zoom at the cursor, drag to pan, double-click to reset. (Elsewhere the cells fall back to static gallery images. More at https://orbitalcommons.github.io/rizzma/demo/.)
§rizzma
A single-crate Rust reimplementation of the good parts of matplotlib / pyplot, with first-class WebAssembly support.
Everything lives in one publishable crate. The former workspace crates are now
namespaced modules — figure, pyplot, axis, artist, mathtext,
the backends (skia, svg, pdf), and mplot3d — so you can reach any
part of the API through a single dependency.
use rizzma::Figure;
let mut fig = Figure::new(4.0, 3.0);
let ax = fig.add_axes(0.1, 0.1, 0.8, 0.8);
ax.plot(&[0.0, 1.0, 2.0], &[0.0, 1.0, 0.0]);
let png = fig.encode_png().expect("encode");
assert!(!png.is_empty());§Features
The core plotting stack plus the SVG/PDF/raster backends are always compiled. The optional leaf modules are enabled by default but can be turned off:
plot3d— themplot3d3D plotting module.pyplot— the statefulpyplotfacade.show— the native-onlyshowinteractive browser viewer.wasm— thewasmbrowser bridge.
Building with --no-default-features yields the core, figure, and all backends
without 3D, pyplot, or wasm.
§Colormaps
The default colormap is bgyw (CET-L09), a perceptually uniform linear map
from Peter Kovesi’s CET collection: its lightness rises at a constant rate,
so equal steps in your data read as equal steps of contrast on screen. The
full set of Kovesi maps featured in the paper ships with the crate,
organized by lightness profile — linear, diverging, rainbow, cyclic, and
isoluminant; see core::color::cmap for the taxonomy and when to reach
for each class. The classic vendor maps (jet, hot, hsv, rainbow)
hide and invent features, so they live behind the
core::color::misleading module and a misleading: name prefix — usable,
but never by accident.
Reference: Peter Kovesi. Good Colour Maps: How to Design Them. arXiv:1509.03700 [cs.GR] 2015.
Re-exports§
pub use core::rcparams::RcParams;pub use core::rcparams::TickDirection;pub use figure::Axes;pub use figure::Figure;pub use figure::GridSpec;pub use figure::LegendLocation;pub use figure::PolarAxes;pub use figure::SkyAxes;pub use figure::SkyProjection;pub use figure::SubplotSpec;pub use figure::TextBoxStyle;pub use portable::PortableError;
Modules§
- artist
- Artist scene graph and drawable primitives for rizzma.
- axis
- Axis machinery for rizzma.
- core
- Core primitives for rizzma.
- figure
- Figure and layout scaffolding for rizzma.
- mathtext
- Mathtext for rizzma.
- mplot3d
- 3D plotting for rizzma.
- PDF vector backend for rizzma.
- portable
- Portable figures: a self-describing artifact that renders itself anywhere.
- pyplot
pyplot-style stateful facade for rizzma.- render
- The renderer seam for rizzma.
- show
show()— an interactive local-browser viewer for figures.- skia
- tiny-skia raster backend for rizzma.
- svg
- SVG vector backend for rizzma.
- text
- Fonts and text layout for rizzma.
- wasm
- Wasm/browser target for rizzma.
Constants§
- VERSION
- The version of this crate, from
CARGO_PKG_VERSION.