sugikey


Namesugikey JSON
Version 0.4.0 PyPI version JSON
download
home_pageNone
SummaryDrawing Sankey diagrams in Python
upload_time2024-10-05 20:10:18
maintainerNone
docs_urlNone
authorYour Name
requires_python<4.0,>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Sugikey


## Description
This package aims at providing a reasonably simple and flexible way to draw Sankey diagrams and related flow diagrams in Python.
Sankey diagrams are flow diagrams composed of arrows of width proportional to the flow of e.g. energy or mass. We use the Sugiyama method to derive [layered graph layouts](https://en.wikipedia.org/wiki/Layered_graph_drawing), hence the portmanteau _Sugi(yama)(San)key_.

Some key facts:
* Consumes [pandas](https://pandas.pydata.org/) dataframes or [networkx](https://networkx.org/) directed graphs as inputs.
* Uses [NetworkX](https://networkx.org/) for processing of the underlying graph structure.
* Produces visual output with [Matplotlib](https://matplotlib.org/).
* Limitation: the created diagrams are not interactive, i.e. the arrows cannot be moved. Interactive Sankey diagrams can be created with a variety of other tools, including [d3-Sankey](https://github.com/d3/d3-sankey).


## Visuals
![image info](docs/imgs/balanced_with_cross_edge.svg)

## Installation
The simplest way to use Sugikey is to install the [pypi package](https://pypi.org/project/sugikey/): `pip install sugikey`.

You can also use the Python code from the repository, provided you have installed the required packages. We use [Poetry](https://python-poetry.org/) for dependency management.

You will need Python >= 3.9, as well as [NetworkX](https://networkx.org/), [pandas](https://pandas.pydata.org/), [Matplotlib](https://matplotlib.org/) and [PuLP](https://coin-or.github.io/pulp/) for layout methods using mathematical optimization.
The dependencies are managed with [Poetry](https://python-poetry.org/), which you can use to install the package (see _poetry.lock_ and _pyproject.toml_).

## Usage
The simplest way to use the package are the high-level functions _sankey_from_dig_ and _sankey_from_df_, which take as input a networkx directed graph and a pandas dataframe, respectively.

```python
import pandas as pd
from sugikey import sankey

# Sankey diagram from a pandas dataframe
flow_df = pd.read_csv(csv_path)
sankey.sankey_from_df(flow_df)
```

```python
from sugikey import sankey

# Sankey diagram from a networkx directed graph
dig = examples.balanced_tree_with_cross_edge()
sankey.sankey_from_dig(dig)
```

Have a look at the [documentation](https://gitabab.gitlab.io/sugikey/) for more information.

## More on Sankey diagrams

* [Why Sankey diagrams are so great for understanding energy data](https://medium.com/@spectalizer/why-sankey-diagrams-are-so-great-for-understanding-energy-data-b14649d40890)

* [Sankey diagrams now have the package they deserve](https://medium.com/@spectalizer/sankey-diagrams-now-have-the-new-python-package-they-deserved-68754a0830d3)

## Support

Write an issue if there is an issue.


## Authors and acknowledgment
Zlatan B.


## Project status
This is a personal project without any guarantee.
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sugikey",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/85/cc/aae68550ec3c228ed3346cfc8fd140bb53a3443ad2e8b7545f6647237fb5/sugikey-0.4.0.tar.gz",
    "platform": null,
    "description": "# Sugikey\n\n\n## Description\nThis package aims at providing a reasonably simple and flexible way to draw Sankey diagrams and related flow diagrams in Python.\nSankey diagrams are flow diagrams composed of arrows of width proportional to the flow of e.g. energy or mass. We use the Sugiyama method to derive [layered graph layouts](https://en.wikipedia.org/wiki/Layered_graph_drawing), hence the portmanteau _Sugi(yama)(San)key_.\n\nSome key facts:\n* Consumes [pandas](https://pandas.pydata.org/) dataframes or [networkx](https://networkx.org/) directed graphs as inputs.\n* Uses [NetworkX](https://networkx.org/) for processing of the underlying graph structure.\n* Produces visual output with [Matplotlib](https://matplotlib.org/).\n* Limitation: the created diagrams are not interactive, i.e. the arrows cannot be moved. Interactive Sankey diagrams can be created with a variety of other tools, including [d3-Sankey](https://github.com/d3/d3-sankey).\n\n\n## Visuals\n![image info](docs/imgs/balanced_with_cross_edge.svg)\n\n## Installation\nThe simplest way to use Sugikey is to install the [pypi package](https://pypi.org/project/sugikey/): `pip install sugikey`.\n\nYou can also use the Python code from the repository, provided you have installed the required packages. We use [Poetry](https://python-poetry.org/) for dependency management.\n\nYou will need Python >= 3.9, as well as [NetworkX](https://networkx.org/), [pandas](https://pandas.pydata.org/), [Matplotlib](https://matplotlib.org/) and [PuLP](https://coin-or.github.io/pulp/) for layout methods using mathematical optimization.\nThe dependencies are managed with [Poetry](https://python-poetry.org/), which you can use to install the package (see _poetry.lock_ and _pyproject.toml_).\n\n## Usage\nThe simplest way to use the package are the high-level functions _sankey_from_dig_ and _sankey_from_df_, which take as input a networkx directed graph and a pandas dataframe, respectively.\n\n```python\nimport pandas as pd\nfrom sugikey import sankey\n\n# Sankey diagram from a pandas dataframe\nflow_df = pd.read_csv(csv_path)\nsankey.sankey_from_df(flow_df)\n```\n\n```python\nfrom sugikey import sankey\n\n# Sankey diagram from a networkx directed graph\ndig = examples.balanced_tree_with_cross_edge()\nsankey.sankey_from_dig(dig)\n```\n\nHave a look at the [documentation](https://gitabab.gitlab.io/sugikey/) for more information.\n\n## More on Sankey diagrams\n\n* [Why Sankey diagrams are so great for understanding energy data](https://medium.com/@spectalizer/why-sankey-diagrams-are-so-great-for-understanding-energy-data-b14649d40890)\n\n* [Sankey diagrams now have the package they deserve](https://medium.com/@spectalizer/sankey-diagrams-now-have-the-new-python-package-they-deserved-68754a0830d3)\n\n## Support\n\nWrite an issue if there is an issue.\n\n\n## Authors and acknowledgment\nZlatan B.\n\n\n## Project status\nThis is a personal project without any guarantee.\nIf you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Drawing Sankey diagrams in Python",
    "version": "0.4.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9484b7d24d89f40428e506920f7ac32b0d24b9e6422aff152c9bbd1c6b93b001",
                "md5": "62fd251cae8867af18d6782a415c0f16",
                "sha256": "7ef149f1600d9bbecf29be838f517695d3ff8c1a8516b1af3c0ca0b220047cc3"
            },
            "downloads": -1,
            "filename": "sugikey-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "62fd251cae8867af18d6782a415c0f16",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 21031,
            "upload_time": "2024-10-05T20:10:17",
            "upload_time_iso_8601": "2024-10-05T20:10:17.439361Z",
            "url": "https://files.pythonhosted.org/packages/94/84/b7d24d89f40428e506920f7ac32b0d24b9e6422aff152c9bbd1c6b93b001/sugikey-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "85ccaae68550ec3c228ed3346cfc8fd140bb53a3443ad2e8b7545f6647237fb5",
                "md5": "9efa2b13c55258f02a2201ff77b27096",
                "sha256": "749921ffdeef42bd1e2850291f96a37f290e0d7dad99628e93ed6bd318fa7600"
            },
            "downloads": -1,
            "filename": "sugikey-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9efa2b13c55258f02a2201ff77b27096",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 19824,
            "upload_time": "2024-10-05T20:10:18",
            "upload_time_iso_8601": "2024-10-05T20:10:18.898916Z",
            "url": "https://files.pythonhosted.org/packages/85/cc/aae68550ec3c228ed3346cfc8fd140bb53a3443ad2e8b7545f6647237fb5/sugikey-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-05 20:10:18",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "sugikey"
}
        
Elapsed time: 0.35505s