plotine
English | 中文
A high-level, LLM-friendly Rust native scientific plotting library (static 2D + basic 3D).
Publication-quality defaults, type-safe APIs that fail at compile time when possible, and errors that tell agents how to fix themselves. Visual defaults track stock matplotlib — the API stays Rust-native.
Post-M8 alignment: M9–M13 done; M14–M17 add EPS/PGF/MP4, non-blocking GUI + widgets, stats/GeoJSON, docs. Gap scores:
docs/MPL_GAP.md.
Status
v0.5.1 — M0–M8 static charts + M9–M17 (GUI, animation, geo, pyplot façade, LaTeX,
PGF/EPS/MP4, widgets, stats/GeoJSON, docs). Gap scores: docs/MPL_GAP.md.
First crates.io upload: follow docs/RELEASING.md (cargo login required).
Gallery
Full set: cargo run -p plotine --example gallery → ./gallery/.
Installation
= "0.5"
# Optional extras:
# plotine = { version = "0.5", features = ["gui", "gif", "mp4", "eps", "latex"] }
Quick start
use *;
// Polars: three lines after you have a DataFrame
let = xy?;
new.axes.save?;
// evcxr Jupyter (feature = "evcxr")
new.axes.evcxr_display?;
Performance
End-to-end Figure build + export (release, median of 7 iters after 2 warmups;
5.0×3.5 in @ 150 DPI). Numbers below are indicative (Windows laptop); re-run
locally or via the Benchmark workflow.
| Scenario | plotine | matplotlib | speedup |
|---|---|---|---|
series.line_n10000 |
~16 ms | ~42 ms | ~2.7× |
stat.heatmap_128 |
~24 ms | ~52 ms | ~2.2× |
d3.surface_40 |
~42 ms | ~92 ms | ~2.2× |
layout.subplots_2x2 |
~12 ms | ~112 ms | ~9× |
fmt.svg_line_n1000 |
~0.7 ms | ~25 ms | ~35× |
speedup = mpl / plotine (>1 ⇒ plotine faster). See docs/BENCHMARK.md
for the full suite (smoke / default / stress tiers).
Charts & features
| API | Notes |
|---|---|
line / scatter / bar / hist / area / errorbar |
M1 core set |
heatmap + .cmap / .colorbar |
row-major grid; Viridis…Cividis |
boxplot / violin |
Tukey / Gaussian KDE |
plotine::polars::xy (feature = "polars") |
DataFrame columns → Series |
Array1 / heatmap_array (feature = "ndarray") |
ndarray adapters |
Figure::evcxr_display (feature = "evcxr") |
Jupyter inline PNG |
Figure::subplots / GridSpec |
multi-panel grid + hspace/wspace |
x_datetime / y_datetime |
Unix seconds → date tick labels |
legend(Legend::…) |
13 positions incl. Best / Outside* |
x_scale / y_scale (Linear / Log / Symlog) |
set before artists for log auto-limits |
Theme::light/dark/paper |
built-in themes |
.save("out.png"|"out.svg"|"out.pdf"|"out.pgf") |
+ .eps with feature = "eps" (Ghostscript) |
Figure::show / show_nonblocking / show_with (gui) |
Blocking or ion()-like; Slider/Button side panel |
Figure::animate / Animation |
PNG sequence / GIF (gif) / MP4 (mp4 + ffmpeg) |
ax.projection / coastline / geojson |
PlateCarree / Mercator + NE 110m + GeoJSON overlay |
plotine::stats |
corr_heatmap / pair_scatter / regline (seaborn-thin) |
plotine-pyplot (separate crate) |
Opt-in plt::plot / savefig facade — not the primary API |
Figure::usetex (feature = "latex") |
System latex+dvipng; default remains built-in mathtext |
Documentation
English
| Document | Description |
|---|---|
book/ |
mdBook user guide + tutorials (mdbook serve book) |
docs/MPL_GAP.md |
Feature comparison & scores vs matplotlib |
docs/API_FREEZE.md |
0.5 → 1.0-rc API stability review |
docs/RELEASING.md |
crates.io publish cadence & checklist |
docs/BENCHMARK.md |
Benchmark design (scenarios + methodology) |
docs/GUI_TOOLBAR.md |
Interactive GUI capability matrix |
CONTRIBUTING.md |
PR workflow & visual-review expectations |
CODE_OF_CONDUCT.md |
Community standards (Contributor Covenant) |
SECURITY.md |
Vulnerability reporting policy |
AGENTS.md |
Idioms & migration guide for coding agents |
llms.txt / llms-full.txt |
LLM-oriented API index |
CHANGELOG.md |
Release history & breaking changes |
中文 (Chinese)
| 文档 | 说明 |
|---|---|
docs/DEVELOPMENT_PLAN.md |
顶层架构设计 & 里程碑路线图 / Architecture & roadmap |
docs/MPL_2D_COVERAGE.md |
matplotlib 静态 2D 图型覆盖清单 / Chart coverage checklist |
License
MIT — see LICENSE.
Embedded DejaVu Sans retains its own license (see crates/plotine-text/fonts/LICENSE).
Natural Earth 110m coastline data is public domain.
Full third-party attribution: THIRD_PARTY_LICENSES.md.