Skip to main content

A simple, (almost) dependency free array visualiser for the terminal

Project description

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 colormapscividis, 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,
)
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.

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

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

numpix-0.9.12.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

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

numpix-0.9.12-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file numpix-0.9.12.tar.gz.

File metadata

  • Download URL: numpix-0.9.12.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for numpix-0.9.12.tar.gz
Algorithm Hash digest
SHA256 cdc369e9c9db15bd285063a7a41c22da9f69bc8f174057e7dc9a1b5db57e021f
MD5 3f911c8f840ba03f6c8f14a519db7fd8
BLAKE2b-256 aa06669d4c15c6b0547ceddd218b5031963a454cc3ceccd22a39d7593c9a8c82

See more details on using hashes here.

File details

Details for the file numpix-0.9.12-py3-none-any.whl.

File metadata

  • Download URL: numpix-0.9.12-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for numpix-0.9.12-py3-none-any.whl
Algorithm Hash digest
SHA256 b85ed29df4d166c794b05ae94ab975f318239aa35b66b38ca3c7f611beb8b187
MD5 8cbfa6cf3556c3f67204cb4d7427c092
BLAKE2b-256 6b40c75e9d3c4f0829d123b2e449890061756dd18bc3f3c094cbeaf510d23da1

See more details on using hashes here.

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