Skip to main content

A compact Matplotlib streamgraph helper with ordering, margins, smoothing, curves, and labels.

Project description

pystreamgraph

A compact Matplotlib streamgraph helper, partially vibe-coded, with a lot of options for layout, smoothing, label placement etc.

Install

pip install pystreamgraph

Install from GitHub (no PyPI name needed)

pip install git+https://github.com/MNoichl/pystreamgraph.git

Quickstart

import numpy as np
import matplotlib.pyplot as plt
from pystreamgraph import plot_streamgraph

rng = np.random.default_rng(7)
n, k = 40, 5
X = np.arange(n)
base = np.linspace(0, 2*np.pi, n)
Y = []
for i in range(k):
    phase = rng.uniform(0, 2*np.pi)
    amp = rng.uniform(0.6, 1.3)
    y = amp * (np.sin(base + phase) + 1.2) + rng.normal(0, 0.08, size=n) + 0.15
    y = np.clip(y, 0, None)
    Y.append(y)
Y = np.vstack(Y)

ax = plot_streamgraph(X, Y, labels=list("ABCDE"), sorted_streams=True,
                     margin_frac=0.10, smooth_window=1, cmap=None,
                     curve_samples=16, curve_method="pchip")
ax.set_title("Streamgraph with PCHIP boundaries")
plt.show()

Example streamgraph

Links

API

  • plot_streamgraph(X, Y, ...) – plot a streamgraph onto a Matplotlib Axes.
  • streamgraph_envelopes(Y, ...) – compute bottoms/tops per layer.
  • pchip_interpolate(x, y, ...) – shape‑preserving cubic interpolation.
  • catmull_rom_interpolate(x, y, ...) – Catmull–Rom curve interpolation.

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

pystreamgraph-0.1.4.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

pystreamgraph-0.1.4-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

Details for the file pystreamgraph-0.1.4.tar.gz.

File metadata

  • Download URL: pystreamgraph-0.1.4.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pystreamgraph-0.1.4.tar.gz
Algorithm Hash digest
SHA256 3473c15af3c0a31cdb776a0546ee10e9d141a164c7d42cca7ac1d385784ec727
MD5 bdebe73ef62019f76dae7fad3f17420e
BLAKE2b-256 08e892d2e1fb368e06c57180030f774677f53a566ace390138e7aaa09e3c2727

See more details on using hashes here.

File details

Details for the file pystreamgraph-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: pystreamgraph-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 23.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pystreamgraph-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2cf9a292dafe6124ab738db15883f62c6fbe8c6ff905316e0ff9a77622b6c91b
MD5 030436480cdb33a5f4f37ab029acb032
BLAKE2b-256 b3cd84cc2bb295649e989fea110c85af7c4341d04918cfae787d0017f385df64

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