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.16.2.tar.gz (4.6 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.16.2-cp310-abi3-win_amd64.whl (8.9 MB view details)

Uploaded CPython 3.10+Windows x86-64

ferrum_viz-0.16.2-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.16.2-cp310-abi3-musllinux_1_2_aarch64.whl (7.9 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

ferrum_viz-0.16.2-cp310-abi3-manylinux_2_39_x86_64.whl (8.6 MB view details)

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

ferrum_viz-0.16.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.6 MB view details)

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

ferrum_viz-0.16.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (7.7 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

ferrum_viz-0.16.2-cp310-abi3-macosx_11_0_arm64.whl (7.4 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

ferrum_viz-0.16.2-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (14.9 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.16.2.tar.gz.

File metadata

  • Download URL: ferrum_viz-0.16.2.tar.gz
  • Upload date:
  • Size: 4.6 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.16.2.tar.gz
Algorithm Hash digest
SHA256 3c8697f217d54bdf6eac28a8a7332112bab1e271343c0428d390635eb19fe8ea
MD5 28172a7b8edbe61143f108239429ba89
BLAKE2b-256 8b6d096ae50e0bd5f15165fb2254b1afe12a1dce4b0fc2c09f97fd66bf39ec01

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: ferrum_viz-0.16.2-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 8.9 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.16.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8e7984fe0d894bc2cfe1247ca43d044da49e48e38c00b2333bcd80fcf52ee9e4
MD5 fa25266cb9a4e3ca4934148b0c934f6d
BLAKE2b-256 cf0b7c207e1d7f00e31733638b181fb7e0acb3a385b2ad2d77ecd5e3fefff298

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ferrum_viz-0.16.2-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 69bfe69f116bdbdcacb1c9fdd073059cde96ee6c2c91771c54b37e684d0f571f
MD5 d23dac073e9e12b943a8e87f4f75c1c2
BLAKE2b-256 2d164bd7c7e4122c80f841efd4c2fe3593f7c21b920bf8cae47c5fbfc9892a29

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ferrum_viz-0.16.2-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 39eeed3ec7c5e3678f6ed2a8eaf7c51980a65496cf44bf6b2969e31e0dabb6d5
MD5 0e1151632cac9015a2dbf4c056fe978e
BLAKE2b-256 ade36e80d57adaacf8f13afb5ec059c7dbd9067132fee18a00072f03b90fd9c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_viz-0.16.2-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.16.2-cp310-abi3-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for ferrum_viz-0.16.2-cp310-abi3-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 27d1f29dce3f640e5af4b07c6a5608f069881340e970d2fe4b57a15abbddd3fa
MD5 f2075d90991c06445b051b8226b83a85
BLAKE2b-256 92fda503f64ee6a204cadc5d3196a4c7069de0444fa775e659d46dc222a8b77c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ferrum_viz-0.16.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c418ecc6fbee9eec75045786d0365a5c7bf71a27484323978265f379858b7c62
MD5 e773016b92b880c77c7aa8bc517b38ae
BLAKE2b-256 bce674d7faa90c267da32d7dcb9bb561b4be6ad8053fe858a87d6e5c1fb0e586

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_viz-0.16.2-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.16.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ferrum_viz-0.16.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 690024002775cb7f4228155fa24a48016e8649ae9b072d47507da010347c33f8
MD5 c4c9cb3fbfc0c60d902f455aaef98ee2
BLAKE2b-256 7128fd82f887d32944033c62feb6983094527baf3c89dc09d867977bf1cff390

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_viz-0.16.2-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.16.2-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ferrum_viz-0.16.2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ec3dc8a897b4b1f470ca7897f1654915a99432dd9aa23598a7212c097a4ad0cb
MD5 d8c3d298a9e1c65c4f5c25827eacba0d
BLAKE2b-256 6b5abbca1a4d7af49f5e82e46ea6c9aeac4c8294c1bb211258bedc6b163d1242

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_viz-0.16.2-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.

File details

Details for the file ferrum_viz-0.16.2-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.16.2-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 0969b282051a9b82fbc64e79db5583a90eee3391f85cda951542e98906f9b6ac
MD5 84bb9a918e6238ec70a9940dac3c6d0c
BLAKE2b-256 8f16e0b69e3af26a660f2ddc948aa438dc3140ca3c445c10e4dce40ba08e5bee

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_viz-0.16.2-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