Skip to main content

vizopt

Mathematical optimization for data visualization, specifically designed for graph layouts with hierarchical inclusion constraints ("bubble layouts").

Uses JAX for automatic differentiation and JIT compilation to efficiently optimize layouts via gradient descent.

Read the documentation https://spectalizer.github.io/vizopt/.

Installation

pip install vizopt

To use Optuna-based schedule search (e.g. the star_curriculum notebook):

uv sync --group hyperoptim

Quick Start

import numpy as np
from vizopt.templates import circle_packing

# Define circle radii
rng = np.random.default_rng(0)
radii = rng.uniform(0.1, 1.0, size=20).tolist()

# Pack circles to minimize overlap and bounding box size
positions = circle_packing.optimize_circle_packing(
    radii=radii,
    weight_total_size=10.0,
    collision_offset=0.05,
    optim_kwargs={"n_iters": 3000, "learning_rate": 0.01},
)
# positions is a list of (x, y) tuples, one per circle

Features

  • Multi-objective optimization (edge lengths, compactness, collision avoidance, inclusion constraints)
  • Efficient JAX-based gradient descent with JIT compilation
  • Handles arbitrary hierarchical inclusion relationships
  • Automatic per-variable normalization so optimizer performance is independent of input coordinate scale
  • NetworkX integration with a consistent DiGraph convention: parent → child edges ((u, v) means v ⊂ u)

Examples

See examples/examples_with_bubbles.ipynb for detailed usage.

License

MIT

For developers

Quality assurance

Tests run automatically on every push and pull request via GitHub Actions:

uv run pytest

Type-check all notebooks locally (not in CI):

uv run python scripts/convert_all_notebooks_to_py.py

This converts each notebook to a temporary .py file, runs pyright across all of them, then deletes the generated files. Pass --no-cleanup to keep them for inspection.

Documentation

Using Zensical.

uv run zensical serve

uv run python scripts/nb_to_md.py --execute examples/circle_packing.ipynb docs/examples/from-notebook-circle-packing.md

Metadata

Release files for vizopt 0.0.5

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

Source distribution (sdist)

Source distribution for vizopt 0.0.5
File Size Uploaded
vizopt-0.0.5.tar.gz 67.0 kB Details

Built distribution (wheel)

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

Total release size: 147.1 kB

Release files / vizopt-0.0.5.tar.gz

Download URL vizopt-0.0.5.tar.gz
Size 67.0 kB
Tags Source
SHA-256 checksum
How to use checksums
070d188590afd48385093ccd2c7e2dcee6cb2be4a3110c7c41a0e8e81e7408fd
BLAKE2b-256 checksum
How to use checksums
f7a6b995f8dad71308516af987a24f63cc7a1df25a638fce15985036852d8908
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 20, 2026.

Transparency log

Release files / vizopt-0.0.5-py3-none-any.whl

Download URL vizopt-0.0.5-py3-none-any.whl
Size 80.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c64da2370f8667d56ed77ea28b765bb8b81e0620639ea2953a51fea8150307eb
BLAKE2b-256 checksum
How to use checksums
75d1689b3697a0b4e5bc067dc711a0654040334855ecc8166d97a914620b34be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 20, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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