ruviz
High-performance 2D plotting library for Rust.
Visual Examples
Click any plot to open its runnable Rust source. See the complete gallery for more plot types, themes, publication layouts, and international text examples.
| Line plot | Scatter plot | Heatmap |
|---|---|---|
![]() |
![]() |
![]() |
| Violin plot | Radar chart | Multi-panel figure |
|---|---|---|
![]() |
![]() |
![]() |
Quick Start
Add the crate:
[]
= "0.5.0"
Create and save a PNG:
use *;
Run with:

Common API
The main API is the fluent Plot builder. Series are finalized automatically when
you render, save, or start another series.
use *;
Top-level helpers are available for line, scatter, and bar plots:
use *;
The ruviz::simple module also provides file-oriented helper functions such as
line_plot, scatter_plot, bar_chart, and histogram.
Plot Types
The root Plot builder currently exposes:
- Basic: line, scatter, bar, histogram, box plot, heatmap
- Distribution: KDE, ECDF, violin, boxen
- Composition and polar: pie, donut styling, radar, polar line
- Continuous, discrete, and error plots: contour, area, step, stem, symmetric/asymmetric error bars
- Vector: quiver
- Layout helpers: subplots, legends, grid/tick controls, annotations, insets
Some lower-level modules contain additional experimental plot implementations
that do not yet have a high-level Plot::new().type(...) builder method.
Export
save("plot.png")writes PNG files on native targets.render()returns an in-memoryImage.render_png_bytes()returns PNG bytes.export_svg("plot.svg")writes SVG files on native targets.render_to_svg()returns an SVG string.save_pdf("plot.pdf")is available with thepdffeature.
For browser/wasm targets, use in-memory helpers such as render_png_bytes(),
render_to_svg(), and Image::encode_png() instead of native file-path export
helpers.
Feature Flags
Default features are ndarray_support and parallel.
| Feature | Description |
|---|---|
ndarray_support |
ndarray data support (canonical) |
ndarray |
compatibility alias for ndarray_support |
polars_support |
polars data support |
nalgebra_support |
nalgebra data support |
parallel |
enables the internal parallel renderer and backend metadata |
simd |
SIMD support used by performance-oriented paths |
performance |
shorthand for parallel + simd |
gpu |
enables GPU types and .gpu(true) metadata |
window |
desktop window dependencies |
interactive |
standalone interactive window support |
interactive-gpu |
interactive + gpu |
serde |
serialize themes/configuration types |
pdf |
PDF export via SVG-to-PDF |
typst-math |
Typst-backed text rendering |
animation |
GIF recording support |
full |
broad feature set for native builds |
SVG export is available without enabling the legacy svg feature.
Backend Notes
.backend(...), .auto_optimize(), and .get_backend_name() store or report
backend preference metadata. auto_optimize() conservatively selects Skia rather
than advertising a backend that cannot execute across every public raster path.
Use .resolved_backend_name() for the native Plot PNG path, or
.backend_resolution(...) to inspect the requested backend, actual backend, and
any explicit Skia fallback reason for a raster operation. Supported scatter
workloads resolve to DataShader only when that backend is explicitly configured.
Use release builds and benchmark your actual workload before adding optional performance features. See Backend Selection and Performance Optimization.
Typst Text Mode
Enable Typst-backed text rendering with:
[]
= { = "0.5.0", = ["typst-math"] }
Then call .typst(true). The configured family is passed to plain raster,
plain SVG, and Typst text. Named-font consistency depends on that font being
available to each renderer or SVG viewer; otherwise backend-specific fallback
or substitution may occur. Typst resolves serif, sans-serif, and monospace
to available concrete families. Because Typst has no generic cursive or fantasy
selector, those two values use its selected sans-serif fallback:
use *;
Without typst-math, .typst(true) and TextEngineMode::Typst are not
compiled. If Typst is optional in your crate, forward and guard your own feature:
[]
= { = "0.5.0", = false }
[]
= []
= ["ruviz/typst-math"]
use *;
Examples
Rust documentation examples are in examples/doc_*.rs.
Interactive examples require the interactive feature:
Animation examples require the animation feature:
Documentation
Development
The workspace also contains companion crates and bindings, but this README focuses on the root Rust crate. See the subdirectory READMEs for those package surfaces.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE or http://opensource.org/licenses/MIT)
at your option.





