Skip to main content

Mathematical optimization for data visualization

Project description

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

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
  • 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

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

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

vizopt-0.0.4.tar.gz (44.9 kB view details)

Uploaded Source

Built Distribution

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

vizopt-0.0.4-py3-none-any.whl (56.4 kB view details)

Uploaded Python 3

File details

Details for the file vizopt-0.0.4.tar.gz.

File metadata

  • Download URL: vizopt-0.0.4.tar.gz
  • Upload date:
  • Size: 44.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vizopt-0.0.4.tar.gz
Algorithm Hash digest
SHA256 0bb7dff448042416b528ab4d09f8e727d586c9d0f6c5e72bb82c86c8ac488c0a
MD5 853d0639b683717e0042b787a0d924a4
BLAKE2b-256 0e43539ce00972d491e9bfa152722b467e82d7a5825d6654025efe2e769237a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for vizopt-0.0.4.tar.gz:

Publisher: publish.yml on spectalizer/vizopt

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

File details

Details for the file vizopt-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: vizopt-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 56.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vizopt-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0f74fcb9f8117c628865d4823e4386bc19f2c4091f4db4f51175ebc5c6b2ea51
MD5 fdb7230051ab8b41a0af31dc0b4bd53d
BLAKE2b-256 e9f09dc840ab5181fca89e32c195982c52c617a22ac524e409ef7fce90558ed3

See more details on using hashes here.

Provenance

The following attestation bundles were made for vizopt-0.0.4-py3-none-any.whl:

Publisher: publish.yml on spectalizer/vizopt

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