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.

Quickstart

pip install ferrum-viz
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")

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, and ibis all work through Chart(data).
  • 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 maturin develop       # build Rust extension
uv run pytest                                       # run tests

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

ferrum_viz-0.8.0-cp310-abi3-win_amd64.whl (7.7 MB view details)

Uploaded CPython 3.10+Windows x86-64

ferrum_viz-0.8.0-cp310-abi3-manylinux_2_39_x86_64.whl (7.5 MB view details)

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

ferrum_viz-0.8.0-cp310-abi3-macosx_11_0_arm64.whl (6.4 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: ferrum_viz-0.8.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 7.7 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.8.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 05142ac76e5f0fc85e514206c5a551f9489c0f5fd3f31b66ecf6abeec3a2bc6b
MD5 4be40904028d4555952769bf4cb97753
BLAKE2b-256 9b836f30fac98ce9b5ae0f7f94fc5acbeedd75b1ac7f4b9b09bfa0d020722701

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ferrum_viz-0.8.0-cp310-abi3-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 ead1c05d0eb8c8590a0314a8dbcd7f54140def3b1e85ed820c9bdcd1acc5b456
MD5 b711fd678a4727c734c0820fdf2d8b3c
BLAKE2b-256 520fb2b5b04fd2070ceecd9ef4e82df9328b35ffbfd9cf35a93cb1cf0445aec7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ferrum_viz-0.8.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 357b9890874d383c81d86e6eadd32887589f6adad64f9220485b7aa696c0d00a
MD5 b0726cde7c3ef46c16a42177538624d4
BLAKE2b-256 64e0b87a3f83809f43abd552c6f7a97bf17831ba28390038d8d8d00010ccaae5

See more details on using hashes here.

Provenance

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