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

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

pip install ferrum-viz

Install with all optional extras (scikit-learn, SHAP, Jupyter interactive rendering):

pip install ferrum-viz[all]

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.
  • 12 built-in themes — from Paper Ink (warm cream default) to dark, publication, and editorial styles.

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

Ferrum was designed and implemented in 9 days by one human and an agentic Claude framework — 918 commits, ~97k lines of source, 3,358 tests. The project uses a six-layer automation architecture with language-specific coding agents, commit-level review gates, and repeatable quality campaigns. See design-docs/development-meta-analysis.md for the full 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.9.0.tar.gz (3.8 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.9.0-cp310-abi3-win_amd64.whl (8.0 MB view details)

Uploaded CPython 3.10+Windows x86-64

ferrum_viz-0.9.0-cp310-abi3-manylinux_2_39_x86_64.whl (7.8 MB view details)

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

ferrum_viz-0.9.0-cp310-abi3-macosx_11_0_arm64.whl (6.7 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: ferrum_viz-0.9.0.tar.gz
  • Upload date:
  • Size: 3.8 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.9.0.tar.gz
Algorithm Hash digest
SHA256 939a61e9600f383fd42ad12db91fff131844f220916efd6643a7e3af02162d4c
MD5 cd200d7fd11728e87adab716cab98acb
BLAKE2b-256 11a28baa9526951805caf38ab39bb92722c31336b46439cd3bf6205eb4a9536e

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: ferrum_viz-0.9.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 8.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.9.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f17577a7a3174c9e93076c6aa853715b272bae596ef567e07f9dfba0f7b1aae6
MD5 2da415054f2783dbcc60096bb89e721c
BLAKE2b-256 213b24a959861b95760754ec30cc98cc7cd308f11960e9bb6e02ceac95a0c278

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ferrum_viz-0.9.0-cp310-abi3-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 a8f91f4cc4702ea2c987177e77f2faef2bc1bac36f099b9c7fd8f8853c080698
MD5 4c206bba22fe30b930395a9cab4d4cf9
BLAKE2b-256 a8edea1c66d9b4352f03afb8459c9f5c3767e4136cddfab62fba08ec9b6cf8ec

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ferrum_viz-0.9.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 62ddb47ea1bee67c97756e6fae3e12ec2ae1411de91067b54881d9ccfd65225a
MD5 2fc5a8f5110844ea7774be755297d99e
BLAKE2b-256 2a579cd83280331c7a997e5b8e3c94630cc2287fc257f78123437a18372cb6ce

See more details on using hashes here.

Provenance

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