Skip to main content

Create Sankey diagrams with Matplotlib.

Project description

matplotlib-sankey

codecov Version PyPI - Python Version GitHub Actions Workflow Status DOI

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

Sankey plot example

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

matplotlib_sankey-0.3.2.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

matplotlib_sankey-0.3.2-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

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

Hashes for matplotlib_sankey-0.3.2.tar.gz
Algorithm Hash digest
SHA256 4244853b32e38bc1569dd23fe782731486faa6e74bdc97f48154ef2180a2070b
MD5 c98ef2b197606bc59e446c7c6e6aa486
BLAKE2b-256 7143676dd09556fcd8c778e66606ca9707b94aa7fff10d8df7ba33e094dabf5b

See more details on using hashes here.

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

Hashes for matplotlib_sankey-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 db7a579e1999c42534f6f54a6ffd4402dea0197920a945adce2f968df24099cd
MD5 f510159bdcb31a0528e2eabfd76077ea
BLAKE2b-256 e5c9d1022fd88a64566b9ef5c90097c8204e56dff05f264b9c761b4d1c08e3d2

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