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 — 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.to_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.18.0.tar.gz (4.9 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.18.0-cp310-abi3-win_amd64.whl (9.0 MB view details)

Uploaded CPython 3.10+Windows x86-64

ferrum_viz-0.18.0-cp310-abi3-musllinux_1_2_x86_64.whl (8.9 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

ferrum_viz-0.18.0-cp310-abi3-musllinux_1_2_aarch64.whl (8.0 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

ferrum_viz-0.18.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.7 MB view details)

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

ferrum_viz-0.18.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (7.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

ferrum_viz-0.18.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (15.0 MB view details)

Uploaded CPython 3.10+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: ferrum_viz-0.18.0.tar.gz
  • Upload date:
  • Size: 4.9 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.18.0.tar.gz
Algorithm Hash digest
SHA256 cbe8ae426aaf2afd0e554b8d445aec628b68c25c924a6de65dec77948d874a59
MD5 8b60afacb6d46cebd719492268440eac
BLAKE2b-256 b4e1db5278efefe8a72b1fafd5db8288f9d06639414336cbe86cf632a2c1a7fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_viz-0.18.0.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.18.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: ferrum_viz-0.18.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 9.0 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.18.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 fcca65b0cc6d0dbbfdf3bfdd26865fcb5eb71322948e743f42d01bea4875defd
MD5 c316902474972bb998069023d56901f9
BLAKE2b-256 451b204b791eded7b3f71cdfa803f3e44884d7264c736e2bd8ca2d2cc717af2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_viz-0.18.0-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.18.0-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for ferrum_viz-0.18.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 6e7b690c30cfc1dd9796547e26f0c021a35d5697e3bf69c826ded1bc1cac8c3d
MD5 82fdb6c0d15d005e653eb9332705d8f0
BLAKE2b-256 6a4fbbb2b84c2a84b39013c7c2eba3b297a67e9ea3af925fd9e24b5bd7539a70

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_viz-0.18.0-cp310-abi3-musllinux_1_2_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.18.0-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for ferrum_viz-0.18.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 e3a9889ea2f9b2b3a76c06bfd90a884b57b22a63bc0cc5dd7a02fc11696e0435
MD5 52690fed8f036f7ef9889f496395b02c
BLAKE2b-256 d860f0f998d58cd58d13b558e5648cbaf6b0b7867c8d9441a9c48e87ba98f407

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_viz-0.18.0-cp310-abi3-musllinux_1_2_aarch64.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.18.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ferrum_viz-0.18.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aaf4fb35cef8ef469d88c178694c2e44bbd8b9459c12d4a8c48197bf46437d83
MD5 1ef22517ec22a06b0865996b54892e8d
BLAKE2b-256 82ee6e77b94f44947b760337e05946b6fe0ac3a8392d5644bd53c62d6cd6ac0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_viz-0.18.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_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.18.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ferrum_viz-0.18.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 66242f2ec29e9b8ee1989b4eea98f480cee2f80a64409e4c9629de783e29d76b
MD5 b19aa5edfa1230a13a03e4dd87e5a76f
BLAKE2b-256 e00e316dbf1e104fb07c4810ae533adf14700c2183b11e81cf8b211a81402d39

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_viz-0.18.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.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.18.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for ferrum_viz-0.18.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 abb4d05230140bbf0224dc535c6ea46eba865941ae7d7b793490a3253230f579
MD5 fd11a8ba905e2c122f6a7e627d447403
BLAKE2b-256 a9730a05d9499a0e23bc888bbce2a10daa4bd7a6ca9640a973c56ef8988261d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_viz-0.18.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.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