Metadata-Version: 2.4
Name: pystreamgraph
Version: 0.1.3
Summary: A compact Matplotlib streamgraph helper with ordering, margins, smoothing, curves, and labels.
Project-URL: Homepage, https://github.com/MNoichl/pystreamgraph
Project-URL: Issues, https://github.com/MNoichl/pystreamgraph/issues
Project-URL: Documentation, https://MNoichl.github.io/pystreamgraph/
Author: Rapty
License: MIT License
        
        Copyright (c) 2025 Rapty
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
        
License-File: LICENSE
Keywords: charts,matplotlib,plot,streamgraph,visualization
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Typing :: Typed
Requires-Python: >=3.8
Requires-Dist: matplotlib>=3.4
Requires-Dist: numpy>=1.20
Requires-Dist: scipy>=1.6; python_version >= '3.8'
Description-Content-Type: text/markdown

# 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

```bash
pip install pystreamgraph
```

### Install from GitHub (no PyPI name needed)

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

## Quickstart

```python
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](images/streamgraph_base.png)

## 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.



