Ferrum is a statistical visualization library for Python: a grammar-first charting system that unifies exploratory plots, statistical graphics, interactive views, and model diagnostics, backed by a Rust engine.
Project description
Ferrum
Grammar-of-graphics statistical visualization for Python, with a Rust core.
Ferrum builds every chart — scatter plot, faceted histogram, ROC curve, SHAP beeswarm — from the same grammar of data, encodings, marks, scales, and statistical transforms. The declaration layer is Python; the computation engine is Rust compiled via PyO3.
Install
For 'batteries included'-- ML diagnostic plots and interactive Jupyter rendering:
pip install ferrum-viz[all] # recommended — optional deps for fitted-model diagnostics (scikit-learn), SHAP, and Jupyter interactive
For a lean install without optional extras:
pip install ferrum-viz
Quickstart
import ferrum as fm
import polars as pl
df = pl.DataFrame({"x": [1, 2, 3, 4], "y": [2, 4, 3, 5], "group": ["a", "a", "b", "b"]})
chart = fm.Chart(df).mark_point().encode(x="x", y="y", color="group:N")
chart.save("scatter.svg")
chart.show_png() # raster output, no display server needed
Key features
- One chart model — scatter plots, statistical graphics, and ML diagnostics share the same grammar and compose with
+,|,&. - Stat transforms in the pipeline — KDE, LOESS, bootstrap CIs, binning, and aggregations are declared in the chart spec and computed in Rust.
- Model diagnostics as charts —
fm.roc_chart(model, X, y),fm.confusion_matrix_chart(...),fm.shap_chart(...)return regularChartobjects. - Zero system dependencies — no Cairo, no X11, no display server. Renders anywhere
pip installworks. - DataFrame pluralism — polars, pandas, modin, cuDF, dask, ibis, and pyarrow all work through
Chart(data). - Interactive rendering —
chart.interactive()switches to a GPU-backed WASM renderer with selections, zoom/pan, linked views, and tooltips. Backed byanywidgetfor Jupyter.
Themes
Twelve built-in themes — from warm cream (Paper Ink, the default) to dark, publication, and editorial styles.
Performance
200,000-point scatter benchmark (median of 3 runs, Apple M-series):
| Metric | Ferrum | plotnine | seaborn | Altair | Plotly |
|---|---|---|---|---|---|
| SVG render | 27 ms | 7.56 s | 1.95 s | 2.86 s | 2.51 s |
| SVG file size | 590 KB | 137 MB | 32.6 MB | 57.8 MB | 267 KB |
| PNG render | 78 ms | 2.35 s | 119 ms | — | 2.50 s |
| Interactive HTML | 4.9 MB | — | — | 14.3 MB | 9.8 MB |
At 1M points, Altair OOMs and plotnine takes 39 s. Ferrum renders in 57 ms. Full benchmarks →
How Ferrum compares
| Ferrum | plotnine | seaborn | Altair | Plotly | |
|---|---|---|---|---|---|
| Grammar | Layered, typed encodings, faceting | ggplot2 port, full GoG | Convenience helpers | Vega-Lite declarative | Imperative traces |
| Diagnostics | 44 helpers, 28 visualizers | — | — | — | — |
| Composition | + | & operators |
+ layers, facets only |
Manual subplots | | & (Vega-Lite) |
make_subplots |
| Interactivity | WASM/GPU, selections, linked views | matplotlib backends | matplotlib backends | Vega-Lite selections | Plotly.js |
| Scale ceiling | 10M+ rows | ~100k marks | ~100k marks | ~5k rows | ~500k marks |
| DataFrames | polars, pandas, modin, cuDF, dask, ibis | pandas only | pandas only | pandas, polars | pandas, polars |
| System deps | None | matplotlib | matplotlib | None | None |
| Backend | Rust (SVG, raster, WASM) | matplotlib | matplotlib | Vega-Lite (V8) | Plotly.js (kaleido) |
Detailed migration guides → for plotnine, seaborn, yellowbrick, and scikit-plot.
Examples
# Layer a LOESS trend on a scatter plot
points = fm.Chart(df).mark_point(opacity=0.6).encode(x="x", y="y", color="group:N")
trend = fm.Chart(df).mark_smooth(method="loess").encode(x="x", y="y", color="group:N")
chart = points + trend
# Compose diagnostics into a model report
source = fm.ModelSource(model, X_test, y_test)
report = (fm.roc_chart(source) | fm.confusion_matrix_chart(source)) & fm.importance_chart(source)
report.save("model_report.svg")
# Figure-level helpers
fm.displot(df, x="value", hue="group", kind="kde")
fm.catplot(df, x="species", y="measurement", kind="violin")
fm.pairplot(df, vars=["a", "b", "c"], hue="label")
Architecture
| Layer | Role |
|---|---|
src/ferrum/ |
Python declaration API — Chart, encodings, marks, themes, plots |
crates/ferrum-core/ |
Rust computation engine — transforms, scales, rendering |
| Arrow CDI | Zero-copy data transport between Python and Rust via pyo3-arrow |
Development
Requires Python 3.10+, Rust toolchain, and maturin.
uv sync
unset CONDA_PREFIX && uv run --no-sync maturin develop # build Rust extension
uv run pytest # run tests
How this was built
[!NOTE] Built in 10 days by one human and an agentic Claude framework. 975 commits · 103k lines · 3,829 tests · 12 phases · 13 agents · 16 skills
Documentation
Full docs at ferrumviz.com.
License
See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ferrum_viz-0.13.0.tar.gz.
File metadata
- Download URL: ferrum_viz-0.13.0.tar.gz
- Upload date:
- Size: 4.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa85d6bc65f96e3d22095c9d5f1c8fa0e4212e134a10dd9a951bac392efea2dd
|
|
| MD5 |
0e0c12b98aa96159663d0fbc29adcc1e
|
|
| BLAKE2b-256 |
b12c2fe0a43a4f7c04375cbc51d0bde5755d7683ce3cfc12e8fb4ec59876eeb0
|
Provenance
The following attestation bundles were made for ferrum_viz-0.13.0.tar.gz:
Publisher:
publish.yaml on chris-santiago/ferrum
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ferrum_viz-0.13.0.tar.gz -
Subject digest:
fa85d6bc65f96e3d22095c9d5f1c8fa0e4212e134a10dd9a951bac392efea2dd - Sigstore transparency entry: 1676474076
- Sigstore integration time:
-
Permalink:
chris-santiago/ferrum@9a6b316474b47626c4e0b765748ebf24fe17282c -
Branch / Tag:
refs/tags/v0.13.0 - Owner: https://github.com/chris-santiago
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@9a6b316474b47626c4e0b765748ebf24fe17282c -
Trigger Event:
release
-
Statement type:
File details
Details for the file ferrum_viz-0.13.0-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: ferrum_viz-0.13.0-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 8.6 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66e052dc41b32c249980abff73715e67dfd6db17c2a0d0ec91ed2f8a688d065a
|
|
| MD5 |
28049c5b4f55f6746a834654f1151472
|
|
| BLAKE2b-256 |
99a2c59fd60969039bcb81bbb162bd2b22c2d48187944543610e1afa2d8cac96
|
Provenance
The following attestation bundles were made for ferrum_viz-0.13.0-cp310-abi3-win_amd64.whl:
Publisher:
publish.yaml on chris-santiago/ferrum
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ferrum_viz-0.13.0-cp310-abi3-win_amd64.whl -
Subject digest:
66e052dc41b32c249980abff73715e67dfd6db17c2a0d0ec91ed2f8a688d065a - Sigstore transparency entry: 1676474195
- Sigstore integration time:
-
Permalink:
chris-santiago/ferrum@9a6b316474b47626c4e0b765748ebf24fe17282c -
Branch / Tag:
refs/tags/v0.13.0 - Owner: https://github.com/chris-santiago
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@9a6b316474b47626c4e0b765748ebf24fe17282c -
Trigger Event:
release
-
Statement type:
File details
Details for the file ferrum_viz-0.13.0-cp310-abi3-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: ferrum_viz-0.13.0-cp310-abi3-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 8.3 MB
- Tags: CPython 3.10+, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba428d1d5e4d2a2e3a147b0063a759faa63f3dfd17bdb03ce3320cd80188a0c8
|
|
| MD5 |
9f9fbd18da8b56217aad2d475914b866
|
|
| BLAKE2b-256 |
9a1dd06ac4be0db0d7a98e9f79510734d036f60b975f86c583f30487c950d8a8
|
Provenance
The following attestation bundles were made for ferrum_viz-0.13.0-cp310-abi3-manylinux_2_39_x86_64.whl:
Publisher:
publish.yaml on chris-santiago/ferrum
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ferrum_viz-0.13.0-cp310-abi3-manylinux_2_39_x86_64.whl -
Subject digest:
ba428d1d5e4d2a2e3a147b0063a759faa63f3dfd17bdb03ce3320cd80188a0c8 - Sigstore transparency entry: 1676474275
- Sigstore integration time:
-
Permalink:
chris-santiago/ferrum@9a6b316474b47626c4e0b765748ebf24fe17282c -
Branch / Tag:
refs/tags/v0.13.0 - Owner: https://github.com/chris-santiago
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@9a6b316474b47626c4e0b765748ebf24fe17282c -
Trigger Event:
release
-
Statement type:
File details
Details for the file ferrum_viz-0.13.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: ferrum_viz-0.13.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 7.2 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
458359900008d29e435d08d4b7ed1132028137637f3fe8c4ec42d6e0ceae967c
|
|
| MD5 |
fc8f4d29d5877e8b99a33d89170ff016
|
|
| BLAKE2b-256 |
cb6a0269d9f79b9388c4db5cad37a6a9fe66ca7e5082b9584bc65619b0799a65
|
Provenance
The following attestation bundles were made for ferrum_viz-0.13.0-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
publish.yaml on chris-santiago/ferrum
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ferrum_viz-0.13.0-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
458359900008d29e435d08d4b7ed1132028137637f3fe8c4ec42d6e0ceae967c - Sigstore transparency entry: 1676474143
- Sigstore integration time:
-
Permalink:
chris-santiago/ferrum@9a6b316474b47626c4e0b765748ebf24fe17282c -
Branch / Tag:
refs/tags/v0.13.0 - Owner: https://github.com/chris-santiago
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@9a6b316474b47626c4e0b765748ebf24fe17282c -
Trigger Event:
release
-
Statement type: