Skip to main content

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()

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.3.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.3-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

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

Hashes for pystreamgraph-0.1.3.tar.gz
Algorithm Hash digest
SHA256 fcb608983e0860ba3d3c1986629c40539d6cf6a160908e4e88e787ce1cbeeb42
MD5 3cb21c0c2ef144dad44c3fc29fd4fad8
BLAKE2b-256 baebcc4b45f200a1a00fc78e3aedcf8b30e7c0a1e28119ad0f9f76b185ecbbbe

See more details on using hashes here.

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

Hashes for pystreamgraph-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1284c451470d255e9a166eced78293a3a18955d170a3781303f09fcdac6a43f6
MD5 a55e7c885cfb5eac483a75fed00f1165
BLAKE2b-256 77b654eb1c29619602913c5a89a493d67f6bb3ca40ff82b75812595059b5dd55

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