Metadata-Version: 2.4
Name: matplotlib-sankey
Version: 0.3.0
Summary: Sankey plot for matplotlib
Author: harryhaller001
Maintainer-email: harryhaller001 <harryhaller001@gmail.com>
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Matplotlib
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
License-File: LICENSE
Requires-Dist: matplotlib
Requires-Dist: numpy
Requires-Dist: ipykernel ; extra == "docs"
Requires-Dist: ipython ; extra == "docs"
Requires-Dist: ipywidgets ; extra == "docs"
Requires-Dist: myst-parser ; extra == "docs"
Requires-Dist: nbsphinx ; extra == "docs"
Requires-Dist: networkx[default] ; extra == "docs"
Requires-Dist: sphinx>=4 ; extra == "docs"
Requires-Dist: sphinx-autoapi ; extra == "docs"
Requires-Dist: sphinx-autodoc-typehints ; extra == "docs"
Requires-Dist: sphinx-book-theme>=1 ; extra == "docs"
Requires-Dist: coverage ; extra == "test"
Requires-Dist: flit ; extra == "test"
Requires-Dist: mypy ; extra == "test"
Requires-Dist: pre-commit ; extra == "test"
Requires-Dist: pytest ; extra == "test"
Requires-Dist: ruff ; extra == "test"
Requires-Dist: setuptools ; extra == "test"
Requires-Dist: twine>=4.0.2 ; extra == "test"
Project-URL: Documentation, https://harryhaller001.github.io/matplotlib-sankey/
Project-URL: Homepage, https://github.com/harryhaller001/matplotlib-sankey
Project-URL: Source, https://github.com/harryhaller001/matplotlib-sankey
Provides-Extra: docs
Provides-Extra: test

# matplotlib-sankey

[![codecov](https://codecov.io/gh/harryhaller001/matplotlib-sankey/graph/badge.svg?token=SPSPC7MSV0)](https://codecov.io/gh/harryhaller001/matplotlib-sankey)
[![Version](https://img.shields.io/pypi/v/matplotlib-sankey)](https://pypi.org/project/matplotlib-sankey/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/matplotlib-sankey)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/harryhaller001/matplotlib-sankey/testing.yml)

[Documentation](https://harryhaller001.github.io/matplotlib-sankey/) | [PyPI](https://pypi.org/project/matplotlib-sankey/) | [Github repository](https://github.com/harryhaller001/matplotlib-sankey) | [Codecov](https://codecov.io/gh/harryhaller001/matplotlib-sankey)

Sankey plot for matplotlib

### Installation

Install with pip:

`pip install matplotlib-sankey`

Install from source:

```bash
git clone https://github.com/harryhaller001/matplotlib-sankey
cd matplotlib-sankey
pip install .
```


### Example

```python
data = [
    # (source index, target index, weight)
    [(0, 2, 20), (0, 1, 10), (3, 4, 15), (3, 2, 10), (5, 1, 5), (5, 2, 50)],
    [(2, 6, 40), (1, 6, 15), (2, 7, 40), (4, 6, 15)],
    [(7, 8, 5), (7, 9, 5), (7, 10, 20), (7, 11, 10), (6, 11, 55), (6, 8, 15)],
]

fig, ax = plt.subplots(figsize=(10, 5))
fig.tight_layout()
sankey(
    data=data,
    cmap="tab20",
    annotate_columns=True,
    ax=ax,
    spacing=0.03,
)
```

![Sankey plot example](./docs/source/_static/images/example_sankey_plot.jpg)



### Development

```bash
python3.10 -m virtualenv venv
source venv/bin/activate

# Install dev dependencies
make install
```

