Skip to main content

ruviz for Python

ruviz for Python wraps the Rust plotting runtime with a fluent Python API, static export helpers, native desktop show(), and notebook widget support. It requires Python 3.10 or newer and installs the runtime dependencies needed for NumPy inputs, static rendering, and AnyWidget notebooks.

Install

pip install ruviz

If you want pandas or Polars dataframe inputs, install the matching optional extra:

pip install "ruviz[dataframes]"
# or only one dataframe backend:
pip install "ruviz[pandas]"
pip install "ruviz[polars]"

Quick Start

import numpy as np
import ruviz

x = np.linspace(0.0, 4.0, 50)
y = x**2

(
    ruviz.plot()
    .line(x, y)
    .title("Quadratic")
    .xlabel("x")
    .ylabel("y = x^2")
    .save("quadratic.png")
)

Notebook and Desktop Usage

  • In Jupyter, plot.show() displays a static PNG in the cell output.
  • Use plot.widget() when you want the synced WASM-backed notebook widget.
  • plot.size_px(width, height) also controls the widget's displayed size and aspect ratio.
  • Without size_px(...), the widget uses the default PNG size (640x480) and shrinks proportionally if the notebook column is narrower.
  • Drag the widget's bottom-right handle to resize the display freely.
  • Hold Shift or Ctrl while dragging the handle to preserve the current aspect ratio.
  • In the widget, right click opens the export menu and right drag performs box zoom.
  • Outside notebooks, plot.show() opens the native interactive window.
  • The published Linux wheel focuses on static rendering and notebook widgets. Install from source on Linux if you need the native desktop plot.show() window.
  • plot.render_png() returns PNG bytes and plot.render_svg() returns an SVG string.
  • plot.save(path) writes PNG, SVG, or PDF according to the file extension and returns the output Path.

Reactive Notebook Data

Use ruviz.observable(...) for notebook-driven updates that keep explicit widgets in sync:

import numpy as np
import ruviz

x = np.linspace(0.0, 6.0, 200)
y = ruviz.observable(np.sin(x))

plot = ruviz.plot().size_px(640, 360).line(x, y).title("Live Sine Wave")
widget = plot.widget()

ObservableSeries supports elementwise arithmetic and NumPy ufuncs. Derived observables stay live until you write to them directly. Live observable series are supported by line, scatter, bar, histogram, boxplot, error_bars, and error_bars_xy; other plot types snapshot their inputs.

import numpy as np

scaled = np.sin(y * 2.0 + 0.25)
plot.line(x, scaled)
y.replace(np.cos(x))

deepcopy(plot) creates an independent live copy with fresh observables, while plot.clone() remains a static snapshot copy.

Experimental 3D Alpha

The Python wheel includes the Rust crate's opt-in Cargo feature named exactly 3d. The initial Python surface provides deterministic CPU export for opaque scatter3d, line3d, regular-grid surface, and wireframe plots:

import numpy as np
import ruviz

x = np.linspace(-2.0, 2.0, 32)
y = np.linspace(-2.0, 2.0, 24)
grid_x, grid_y = np.meshgrid(x, y)
z = np.sin(grid_x**2 + grid_y**2)

(
    ruviz.surface(x, y, z)
    .size_px(720, 480)
    .title("3D surface alpha")
    .xlabel("x")
    .ylabel("y")
    .zlabel("z")
    .save("surface.png")
)

For surfaces and wireframes, rows of z correspond to y and columns correspond to x, so z.shape == (len(y), len(x)). Orthographic projection is the default; .perspective_deg(45.0) opts into perspective. This alpha is static-only in Python: interactive orbit widgets, transparency, volume plots, arbitrary meshes, and mixed 2D/3D axes are not yet exposed.

Documentation

Contributor Workflow

cd python
uv sync
uv run maturin develop
uv run python scripts/generate_gallery.py
uv run mkdocs serve

Rebuild the bundled widget frontend from the repository root when you change the web SDK or packages/ruviz-web/src/python-widget.ts:

bun run build:python-widget

Download files

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

Source Distribution

ruviz-0.6.0.tar.gz (5.4 MB view details)

Uploaded Source

Built Distributions

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

ruviz-0.6.0-cp310-abi3-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.10+Windows x86-64

ruviz-0.6.0-cp310-abi3-manylinux_2_28_x86_64.whl (7.1 MB view details)

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

ruviz-0.6.0-cp310-abi3-macosx_11_0_arm64.whl (7.1 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

ruviz-0.6.0-cp310-abi3-macosx_10_12_x86_64.whl (7.4 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file ruviz-0.6.0.tar.gz.

File metadata

  • Download URL: ruviz-0.6.0.tar.gz
  • Upload date:
  • Size: 5.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ruviz-0.6.0.tar.gz
Algorithm Hash digest
SHA256 d33cfb8674b3dfa625da1f47fdc6def1fbbfa5f0691390c094ba6f49881ef971
MD5 59f6a3758b4eb45f2c861f593950afe1
BLAKE2b-256 63214ae5c3cf9c50bd2e2316fae24333f585430a7f47072985e6b9ae4675bee6

See more details on using hashes here.

Provenance

The following attestation bundles were made for ruviz-0.6.0.tar.gz:

Publisher: release.yml on Ameyanagi/ruviz

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

File details

Details for the file ruviz-0.6.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: ruviz-0.6.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 7.2 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ruviz-0.6.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 be9e93ff02af9cc966c529e52e2def1ebd9c02610248203a6cbc9f35632fc528
MD5 e177eabc4092370958a813d371503f27
BLAKE2b-256 2a0e1d3877f910adf12af4136a84a42871e6fa0a057ebe0ba51b3fdf6ac5f399

See more details on using hashes here.

Provenance

The following attestation bundles were made for ruviz-0.6.0-cp310-abi3-win_amd64.whl:

Publisher: release.yml on Ameyanagi/ruviz

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

File details

Details for the file ruviz-0.6.0-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ruviz-0.6.0-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3ad47e2991caabafebf2fd747062998c8ec564a16377667c13768d5f3ee5c317
MD5 3fc8d20b6e30cb5d10ab9fffc2630be5
BLAKE2b-256 011e4a5ef094ab0418a630cd3465d8ab6cc7de5497e74a47de8aa243a3fc5ba5

See more details on using hashes here.

Provenance

The following attestation bundles were made for ruviz-0.6.0-cp310-abi3-manylinux_2_28_x86_64.whl:

Publisher: release.yml on Ameyanagi/ruviz

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

File details

Details for the file ruviz-0.6.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ruviz-0.6.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c97a80b31799e1843c23c05bb4a44bb0976b8cecce8b201c24367c200c83cfb2
MD5 37b42962a1aa9e64f73dd6e7c9bcffc7
BLAKE2b-256 05eb6c6c4531dff572a435512efd4928c85850db19f525d3cb100784ff2f20a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for ruviz-0.6.0-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on Ameyanagi/ruviz

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

File details

Details for the file ruviz-0.6.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ruviz-0.6.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 830b0df851cd9190f14a104f597a36ff1c44b4f8801c2d36ee785e1cca4a5844
MD5 50f358cb777a25d4be216a391ec9f62c
BLAKE2b-256 a1e530dae4ede880cd2e14a39247ec55f81dec0f9eda51075314e644b838d50c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ruviz-0.6.0-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on Ameyanagi/ruviz

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