polyviz


Namepolyviz JSON
Version 1.0.4 PyPI version JSON
download
home_pagehttps://github.com/romainsacchi/polyviz
SummaryInterface between Brightway2 and D3.js
upload_time2024-11-18 15:34:44
maintainerNone
docs_urlNone
authorRomain Sacchi <romain.sacchi@psi.ch>
requires_pythonNone
licenseBSD 3-Clause License Copyright (c) 2020, Romain Sacchi Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords
VCS
bugtrack_url
requirements pandas numpy None country_converter pyyaml
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## ``polyviz``: An interface between ``brightway2`` and [D3.js](https://d3js.org/)

This is a Python package that provides an interface between the
[`brightway2`](https://brightway.dev) LCA framework and the [`D3.js`](https://d3js.org) JavaScript library.
It is designed to be used in Jupyter notebooks, and provides
interactive visualizations of LCA results.

<div align="center">
<img src="https://github.com/romainsacchi/polyviz/raw/main/assets/chord_sample.png" height="300"/>
</div>

This interface extends the capabilities of  [``d3blocks``](https://github.com/d3blocks/d3blocks), and make it compatible
with results generated by `brightway2`.

``polyviz`` allows the following visualizations to be created from LCA results:
* Sankey diagrams ([example 1](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/sankey_1.html), [example 2](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/sankey_2.html))
* Chord diagrams ([example 1](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/chord_1.html), [example 2](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/chord_2.html))
* Force-directed graphs ([example 1](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/force_1.html), [example 2](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/force_2.html))
* Tree maps ([example 1](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/treemap_1.html), [example 2](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/treemap_2.html))
* Choropleth maps ([example 1](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/choro_1.html), [example 2](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/choro_2.html))
* Violin plots ([example 1](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/violin_1.html), [example 2](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/violin_2.html))

## Limitations

Tested only with ``brightway2`` version 2.4.5.

Probably works with version 2.5 too, but not tested.

## Installation

Install ``polyviz`` from PyPI:

```bash
pip install polyviz
```

and you will need to install a forked version of ``d3blocks``:

```bash
pip install git+https://github.com/romainsacchi/d3blocks.git
```

Usage
-----

### Sankey diagrams

```python
from polyviz import sankey
import bw2data

act = bw2data.get_activity(("some db", "some activity"))
method = ("some method", "some method")
sankey(activity=act, method=method)
```

`sankey()` returns a filepath to an HTML file that can be opened in a browser.

Alternatively, you can track a specific flow:

```python

from polyviz import sankey
import bw2data

act = bw2data.get_activity(("some db", "some activity"))
flow_type = "kilowatt hour"
sankey(activity=act, flow_type=flow_type)
```

Other examples are available in the [examples](https://github.com/romainsacchi/polyviz/blob/main/examples/examples.ipynb) notebook.

## Support

Do not hesitate to report issues in the Github repository.

## Maintainers

* [Romain Sacchi](https://github.com/romainsacchi)

## Contributing

See [contributing](https://github.com/romainsacchi/polyviz/blob/master/CONTRIBUTING.md).

## License

[BSD-3-Clause](https://github.com/romainsacchi/polyviz/blob/master/LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/romainsacchi/polyviz",
    "name": "polyviz",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Romain Sacchi <romain.sacchi@psi.ch>",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/c1/fc/1275c0942386fd2cc3c2b244608e978b33758678752b5a96ccd21d36281d/polyviz-1.0.4.tar.gz",
    "platform": null,
    "description": "## ``polyviz``: An interface between ``brightway2`` and [D3.js](https://d3js.org/)\n\nThis is a Python package that provides an interface between the\n[`brightway2`](https://brightway.dev) LCA framework and the [`D3.js`](https://d3js.org) JavaScript library.\nIt is designed to be used in Jupyter notebooks, and provides\ninteractive visualizations of LCA results.\n\n<div align=\"center\">\n<img src=\"https://github.com/romainsacchi/polyviz/raw/main/assets/chord_sample.png\" height=\"300\"/>\n</div>\n\nThis interface extends the capabilities of  [``d3blocks``](https://github.com/d3blocks/d3blocks), and make it compatible\nwith results generated by `brightway2`.\n\n``polyviz`` allows the following visualizations to be created from LCA results:\n* Sankey diagrams ([example 1](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/sankey_1.html), [example 2](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/sankey_2.html))\n* Chord diagrams ([example 1](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/chord_1.html), [example 2](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/chord_2.html))\n* Force-directed graphs ([example 1](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/force_1.html), [example 2](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/force_2.html))\n* Tree maps ([example 1](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/treemap_1.html), [example 2](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/treemap_2.html))\n* Choropleth maps ([example 1](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/choro_1.html), [example 2](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/choro_2.html))\n* Violin plots ([example 1](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/violin_1.html), [example 2](https://htmlpreview.github.io/?https://github.com/romainsacchi/polyviz/blob/main/examples/violin_2.html))\n\n## Limitations\n\nTested only with ``brightway2`` version 2.4.5.\n\nProbably works with version 2.5 too, but not tested.\n\n## Installation\n\nInstall ``polyviz`` from PyPI:\n\n```bash\npip install polyviz\n```\n\nand you will need to install a forked version of ``d3blocks``:\n\n```bash\npip install git+https://github.com/romainsacchi/d3blocks.git\n```\n\nUsage\n-----\n\n### Sankey diagrams\n\n```python\nfrom polyviz import sankey\nimport bw2data\n\nact = bw2data.get_activity((\"some db\", \"some activity\"))\nmethod = (\"some method\", \"some method\")\nsankey(activity=act, method=method)\n```\n\n`sankey()` returns a filepath to an HTML file that can be opened in a browser.\n\nAlternatively, you can track a specific flow:\n\n```python\n\nfrom polyviz import sankey\nimport bw2data\n\nact = bw2data.get_activity((\"some db\", \"some activity\"))\nflow_type = \"kilowatt hour\"\nsankey(activity=act, flow_type=flow_type)\n```\n\nOther examples are available in the [examples](https://github.com/romainsacchi/polyviz/blob/main/examples/examples.ipynb) notebook.\n\n## Support\n\nDo not hesitate to report issues in the Github repository.\n\n## Maintainers\n\n* [Romain Sacchi](https://github.com/romainsacchi)\n\n## Contributing\n\nSee [contributing](https://github.com/romainsacchi/polyviz/blob/master/CONTRIBUTING.md).\n\n## License\n\n[BSD-3-Clause](https://github.com/romainsacchi/polyviz/blob/master/LICENSE).\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License  Copyright (c) 2020, Romain Sacchi  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
    "summary": "Interface between Brightway2 and D3.js",
    "version": "1.0.4",
    "project_urls": {
        "Homepage": "https://github.com/romainsacchi/polyviz"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ebb327ab9ba4cf7a551f7251fff5b9b1445e3476c5a680c0a3df8e12e5fbb57b",
                "md5": "04e267710481b51f8153246b08a0fd0d",
                "sha256": "71fbd75c9ffe5d2373df4b7d919d21bffb3fb2ef1923b9665adc7a18cd8e9fad"
            },
            "downloads": -1,
            "filename": "polyviz-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "04e267710481b51f8153246b08a0fd0d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 19226,
            "upload_time": "2024-11-18T15:34:43",
            "upload_time_iso_8601": "2024-11-18T15:34:43.453938Z",
            "url": "https://files.pythonhosted.org/packages/eb/b3/27ab9ba4cf7a551f7251fff5b9b1445e3476c5a680c0a3df8e12e5fbb57b/polyviz-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c1fc1275c0942386fd2cc3c2b244608e978b33758678752b5a96ccd21d36281d",
                "md5": "123be23bf8997d27ef9ce188c7a688c3",
                "sha256": "38f280a125e69bcd19f175eba5ddc9c4a5568a90f71a153e3ebee508b56827be"
            },
            "downloads": -1,
            "filename": "polyviz-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "123be23bf8997d27ef9ce188c7a688c3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 16182,
            "upload_time": "2024-11-18T15:34:44",
            "upload_time_iso_8601": "2024-11-18T15:34:44.438316Z",
            "url": "https://files.pythonhosted.org/packages/c1/fc/1275c0942386fd2cc3c2b244608e978b33758678752b5a96ccd21d36281d/polyviz-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-18 15:34:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "romainsacchi",
    "github_project": "polyviz",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "pandas",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": null,
            "specs": []
        },
        {
            "name": "country_converter",
            "specs": []
        },
        {
            "name": "pyyaml",
            "specs": []
        }
    ],
    "lcname": "polyviz"
}
        
Elapsed time: 7.12974s