Create Sankey diagrams with Matplotlib.
Project description
matplotlib-sankey
Documentation | PyPI | Github repository | Codecov
Sankey plot for matplotlib
Installation
Install with pip:
pip install matplotlib-sankey
Install with uv:
uv add matplotlib-sankey
Install from source:
git clone https://github.com/harryhaller001/matplotlib-sankey
cd matplotlib-sankey
pip install -e .
Example
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,
)
Development
git clone https://github.com/harryhaller001/matplotlib-sankey
cd matplotlib-sankey
# Create virtual env with uv
uv venv
# Install dev dependencies
make install
# Run all checks
make check
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
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 matplotlib_sankey-0.3.2.tar.gz.
File metadata
- Download URL: matplotlib_sankey-0.3.2.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4244853b32e38bc1569dd23fe782731486faa6e74bdc97f48154ef2180a2070b
|
|
| MD5 |
c98ef2b197606bc59e446c7c6e6aa486
|
|
| BLAKE2b-256 |
7143676dd09556fcd8c778e66606ca9707b94aa7fff10d8df7ba33e094dabf5b
|
File details
Details for the file matplotlib_sankey-0.3.2-py3-none-any.whl.
File metadata
- Download URL: matplotlib_sankey-0.3.2-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db7a579e1999c42534f6f54a6ffd4402dea0197920a945adce2f968df24099cd
|
|
| MD5 |
f510159bdcb31a0528e2eabfd76077ea
|
|
| BLAKE2b-256 |
e5c9d1022fd88a64566b9ef5c90097c8204e56dff05f264b9c761b4d1c08e3d2
|