Skip to main content

numpix

An almost dependency free (as far as I'm concerned, numpy is part of the stdlib of Python haha) array visualizer for the terminal. Inspect numpy, PyTorch, and JAX arrays as colored pixel grids — right in your shell. Think treescope but without the jupyter part.

Features

  • Works with numpy, PyTorch, and JAX — pass any array-like, no conversion needed
  • 1D, 2D, and 3D arrays — 1D arrays render as a row, 3D arrays render slices side-by-side
  • Kitty graphics protocol — crisp, high-resolution rendering in Kitty, Ghostty, and WezTerm; graceful Unicode fallback everywhere else
  • Stats header — shape, min, max, mean, and variance printed above every visualization
  • Multiple colormaps — cividis, magma, inferno, plasma, hot, coolwarm, grey
  • Large array truncation — big arrays are intelligently truncated with a grey separator so you always see both ends
  • Zero dependencies — pure Python stdlib + numpy only

Examples

numpix demo numpix demo

Fallback for terminals that don't support the kitty protocol: numpix demo

Installation

pip install numpix

Usage

from numpix import pix
import numpy as np

# 2D array
pix(np.random.rand(28, 28))

# 1D array — rendered as a single row
pix(np.sin(np.linspace(0, 2 * np.pi, 100)))

# 3D array — slices shown side by side
batch = np.stack([
    np.random.rand(28, 28),
    np.eye(28),
    np.outer(np.sin(np.linspace(0, np.pi, 28)), np.ones(28)),
])
pix(batch)

Works with PyTorch and JAX tensors too — no .numpy() needed:

import torch, jax.numpy as jnp

pix(torch.randn(3, 28, 28))
pix(jnp.array(batch))

Multiple arrays

Pass multiple arrays to pix() to visualize them one after another. Each array gets its own color range by default:

a = np.sin(np.linspace(0, 4 * np.pi, 100)).reshape(10, 10)
b = np.random.rand(10, 10) * 100
pix(a, b)

Use shared_range=True to normalize all arrays to the same color scale — useful for seeing how values evolve across arrays:

pix(a, b, shared_range=True)

Arrays with inf values

pix handles -inf and inf gracefully — -inf maps to the darkest color, inf to the brightest:

masked = np.random.randn(8, 8)
masked[np.tril_indices(8, -1)] = -float("inf")
pix(masked)

API

numpix.pix(
    *arrays,
    max_show: int = 40,
    color_scheme: str = "cividis",
    max_slices: int = 3,
    layout: Literal["horizontal", "vertical"] = "horizontal",
    use_kitty_protocol: bool = True,
    shared_range: bool = False,
    scale: int | Literal["auto"] = "auto",
)
Parameter Description
*arrays One or more numpy ndarrays, PyTorch tensors, or JAX arrays. Up to 3 dimensions each.
max_show Max rows/cols shown before truncating (Unicode fallback mode). Default 40.
color_scheme One of cividis, magma, inferno, plasma, hot, coolwarm, grey. Default cividis.
max_slices Max number of 2D slices shown for 3D arrays. Default 3.
layout Arrange slices "horizontal" (side by side) or "vertical" (stacked). Default "horizontal".
use_kitty_protocol Use the Kitty graphics protocol if supported. Default True.
shared_range When passing multiple arrays, normalize them all to the same color scale. Default False.
scale Block size per value: 1, 2, or 3. Default "auto" (3 for dims <= 3, 2 for 4–10, 1 for larger).

Terminal support

Terminal Rendering
Kitty High-resolution pixel graphics
Ghostty High-resolution pixel graphics
WezTerm High-resolution pixel graphics
Everything else Unicode half-block characters (▄▀)

numpix auto-detects support at import time — no configuration required.

License

MIT

Metadata

Release files for numpix 0.9.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for numpix 0.9.14
File Size Uploaded
numpix-0.9.14.tar.gz 14.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for numpix 0.9.14
File Interpreter ABI Platform
numpix-0.9.14-py3-none-any.whl Python 3 none any Details

Total release size: 27.9 kB

Release files / numpix-0.9.14.tar.gz

Download URL numpix-0.9.14.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b58a564a05f5481b25c86ad648ec2b1727ae5a0368e75a70d188d7e03e63a452
BLAKE2b-256 checksum
How to use checksums
3c0511d009688f8f1d8dfad4a78d63920d2ee1027b78be84e47c66b685a9a7f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / numpix-0.9.14-py3-none-any.whl

Download URL numpix-0.9.14-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ed4b1bda7f0e5054388f426a7519fbcb6b3d2c34adea683e4ae10dd0f64d8a8
BLAKE2b-256 checksum
How to use checksums
89c2339ae795c5c7c3d4886e86ab247a1966db41705e9603760961b3e540a4d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.9.14 This release

2 release files

0.9.10

2 release files

0.9.9

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page