Skip to main content

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 chart examples: linear model, decision boundary, pairplot, SHAP beeswarm

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 — includes scikit-learn, SHAP, 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 chartsfm.roc_chart(model, X, y), fm.confusion_matrix_chart(...), fm.shap_chart(...) return regular Chart objects.
  • Zero system dependencies — no Cairo, no X11, no display server. Renders anywhere pip install works.
  • DataFrame pluralism — polars, pandas, modin, cuDF, dask, ibis, and pyarrow all work through Chart(data).
  • Interactive renderingchart.interactive() switches to a GPU-backed WASM renderer with selections, zoom/pan, linked views, and tooltips. Backed by anywidget for Jupyter.

Themes

Twelve built-in themes — from warm cream (Paper Ink, the default) to dark, publication, and editorial styles.

All 12 Ferrum themes

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

Read the retrospective →

Documentation

Full docs at ferrumviz.com.

License

See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ferrum_viz-0.11.1.tar.gz (4.2 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ferrum_viz-0.11.1-cp310-abi3-win_amd64.whl (8.4 MB view details)

Uploaded CPython 3.10+Windows x86-64

ferrum_viz-0.11.1-cp310-abi3-manylinux_2_39_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.39+ x86-64

ferrum_viz-0.11.1-cp310-abi3-macosx_11_0_arm64.whl (7.0 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file ferrum_viz-0.11.1.tar.gz.

File metadata

  • Download URL: ferrum_viz-0.11.1.tar.gz
  • Upload date:
  • Size: 4.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ferrum_viz-0.11.1.tar.gz
Algorithm Hash digest
SHA256 4220d3c17863b905ef653da335a8d46ce4ba6a4c15bb295694744143bdb6a4bc
MD5 7754ff64e1044fb6994c17cd778c56c0
BLAKE2b-256 92dd7aebd87a53053160b74d93610818f850c7162f77ec63ef517b1c44a339a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_viz-0.11.1.tar.gz:

Publisher: publish.yaml on chris-santiago/ferrum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ferrum_viz-0.11.1-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: ferrum_viz-0.11.1-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 8.4 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

Hashes for ferrum_viz-0.11.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9b5e8adbb191d1034ebcad6403a4a7e71bd8d86840e0b766fcc57d1f0f047f34
MD5 5d635f4b308e8a0d9eaa1bf632ae166e
BLAKE2b-256 c7856ed2f5edd2d0278e734ab467014e619256b65e3896edb9df691a192f2cec

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_viz-0.11.1-cp310-abi3-win_amd64.whl:

Publisher: publish.yaml on chris-santiago/ferrum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ferrum_viz-0.11.1-cp310-abi3-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for ferrum_viz-0.11.1-cp310-abi3-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 c0fcd805f14ee2ffa5a9f4a899e2d07efba8d974d1387bf1d186ff80df29aa1f
MD5 878d6191340e22ad2acd43647c873e42
BLAKE2b-256 bd37f7c53dd5c663a2f8d7bc98a1cad6a64acf35ad664456406e438002ceed27

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_viz-0.11.1-cp310-abi3-manylinux_2_39_x86_64.whl:

Publisher: publish.yaml on chris-santiago/ferrum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ferrum_viz-0.11.1-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ferrum_viz-0.11.1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 786cc256f34e2761787d58b509b4ed29adfc60c4c14478f15eda77c2778586ba
MD5 6e43206f858fbe780908423f6c5fcc3e
BLAKE2b-256 eb182cf34b5ae62315ec7946f312b1dc04d96b821869a78796c4ef6ce8c91896

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_viz-0.11.1-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: publish.yaml on chris-santiago/ferrum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page