A compact Matplotlib streamgraph helper with ordering, margins, smoothing, curves, and labels.
Project description
pystreamgraph
A compact Matplotlib streamgraph helper with ordering, margins, optional smoothing, shape‑preserving PCHIP boundary curves (default), optional Catmull–Rom curves, and label placement.
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()
Links
- Docs: https://MNoichl.github.io/pystreamgraph/
- Source: https://github.com/MNoichl/pystreamgraph
- Issues: https://github.com/MNoichl/pystreamgraph/issues
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
Release history Release notifications | RSS feed
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.3.tar.gz
(2.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pystreamgraph-0.1.3.tar.gz.
File metadata
- Download URL: pystreamgraph-0.1.3.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcb608983e0860ba3d3c1986629c40539d6cf6a160908e4e88e787ce1cbeeb42
|
|
| MD5 |
3cb21c0c2ef144dad44c3fc29fd4fad8
|
|
| BLAKE2b-256 |
baebcc4b45f200a1a00fc78e3aedcf8b30e7c0a1e28119ad0f9f76b185ecbbbe
|
File details
Details for the file pystreamgraph-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pystreamgraph-0.1.3-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1284c451470d255e9a166eced78293a3a18955d170a3781303f09fcdac6a43f6
|
|
| MD5 |
a55e7c885cfb5eac483a75fed00f1165
|
|
| BLAKE2b-256 |
77b654eb1c29619602913c5a89a493d67f6bb3ca40ff82b75812595059b5dd55
|