prettypyplot


Nameprettypyplot JSON
Version 0.11.0 PyPI version JSON
download
home_pagehttps://github.com/braniii/prettypyplot
SummaryWrapper for matplotlib to generate pretty plots.
upload_time2024-05-30 11:41:06
maintainerNone
docs_urlNone
authorbraniii
requires_python>=3.6
licenseBSD 3-Clause License
keywords matplotlib pyplot
VCS
bugtrack_url
requirements matplotlib numpy decorit
Travis-CI No Travis.
coveralls test coverage
            <div align="center">
  <img
    src="https://raw.githubusercontent.com/braniii/prettypyplot/main/docs/gallery/images/logo_large.svg" width="500"
  />

  <p>
    <a href="https://zenodo.org/badge/latestdoi/350406950" alt="DOI">
        <img src="https://zenodo.org/badge/350406950.svg" alt="DOI" /></a>
    <a href="https://github.com/wemake-services/wemake-python-styleguide" alt="wemake-python-styleguide" >
        <img src="https://img.shields.io/badge/style-wemake-000000.svg" /></a>
    <a href="https://github.com/braniii/prettypyplot/actions/workflows/pytest.yml" alt="Pytest" >
        <img src="https://github.com/braniii/prettypyplot/actions/workflows/pytest.yml/badge.svg?branch=main" /></a>
    <a href="https://codecov.io/gh/braniii/prettypyplot" alt="Code coverage">
        <img src="https://codecov.io/gh/braniii/prettypyplot/branch/main/graph/badge.svg" /></a>
    <a href="https://pypi.org/project/prettypyplot" alt="PyPI" >
        <img src="https://img.shields.io/pypi/v/prettypyplot" /></a>
    <a href="https://anaconda.org/conda-forge/prettypyplot" alt="conda version">
        <img src="https://img.shields.io/conda/vn/conda-forge/prettypyplot" /></a>
    <a href="https://pepy.tech/project/prettypyplot" alt="Downloads" >
        <img src="https://pepy.tech/badge/prettypyplot" /></a>
    <a href="https://img.shields.io/pypi/pyversions/prettypyplot" alt="PyPI - Python Version">
        <img src="https://img.shields.io/pypi/pyversions/prettypyplot" /></a>
    <a href="https://github.com/braniii/prettypyplot/-/blob/main/LICENSE" alt="PyPI - License" >
        <img src="https://img.shields.io/pypi/l/prettypyplot" /></a>
    <a href="https://braniii.github.io/prettypyplot" alt="Doc" >
        <img src="https://img.shields.io/badge/mkdocs-Documentation-brightgreen" /></a>
  </p>

  <p>
    <a href="https://braniii.github.io/prettypyplot">Docs</a> •
    <a href="#features">Features</a> •
    <a href="#Installation">Installation</a> •
    <a href="https://braniii.github.io/prettypyplot/gallery">Gallery</a>
  </p>
</div>



# prettypyplot

The documentation including an gallery can be found [here](https://braniii.github.io/prettypyplot).

This is a wrapper package for matplotlib to achieve more easily pretty figures.
If you are looking for something complete, this project is nothing for you
but maybe [seaborn](https://seaborn.pydata.org/). The main aspect of this
project is to help me syncing my rcParams files and to stop copy-pasting so
much code.

The aim of this project is to simplify the generation of some simple
pre-defined figures. Almost all code is inspired or taken from the
[matplotlib gallery](https://matplotlib.org/gallery/index.html). If you are a
power user or interested in generating complex figures, this packages is not
ment for you and you should better take a look in the matplotlib gallery
directly.

This project is in an alpha stage, hence it is neither stable nor ready for
production.
> **CAUTION**:
> Starting from version 1.0.0 (which is far in the future) API-breaking
> changes will be made only in major releases. Until then, it can be changed
> in every minor release (see [changelog](#changelog)).

## Features

The most notable features are:

- Tested with matplotlib `3.2`-`3.8`
- figsize specifies size of canvas. So labels, ticks or colorbars are not counted.
- Nice top-aligned outter legends
- New colors

## Usage

This package uses an syntax very close to matplotlib. Hence, it should be
straight forward to use it. Instead of calling a function on the axes itself,
one needs to pass here the axes as an argument (args or kwargs).

### Installation

```python
python3 -m pip install --upgrade prettypyplot
```
or
```python
conda install -c conda-forge prettypyplot
```
or for the latest dev version
```python
python3 -m pip install git+https://github.com/braniii/prettypyplot.git
```

### Usage

```python
import matplotlib.pyplot as plt
import prettypyplot as pplt

pplt.use_style()
fig, ax = plt.subplots()
...
pplt.plot(ax=ax, x, y)
pplt.savefig(output)
```

### Known Bugs

- `plt.subplots_adjust()` does not work with `pplt.savefig(use_canvas_size=True)`
If you find one, please open an issue.
- `pplt.savefig(use_canvas_size=True)` is not compatible with a grid of subplots

### Known Workarounds

The method `pyplot.subplots_adjust()` is not compatible with the option
`use_canvas_size` in `prettypyplot.plot.savefig`,
use instead:
```python
# this doesn't work, use instead gridspec
fig.subplots_adjust(hspace=0)
# use this instead
fig, axs = plt.subplots(..., gridspec_kw={'hspace': 0.000})
```

## Comparison to `matplotlib`

<table>
    <tr width="700" valign="top">
        <td>
            <code>matplotlib.pyplot.plot</code><br>
            <img src="https://braniii.github.io/prettypyplot/gallery/comparison/mpl_plot.png" width="350">
        </td>
        <td>
            <code>prettypyplot.plot</code><br>
            <img src="https://braniii.github.io/prettypyplot/gallery/comparison/default_plot.png" width="350">
        </td>
    </tr>
    <tr width="700" valign="top">
        <td>
            <code>matplotlib.pyplot.legend</code><br>
            <img src="https://braniii.github.io/prettypyplot/gallery/comparison/mpl_plot_legend.png" width="350">
        </td>
        <td>
            <code>prettypyplot.legend</code><br>
            <img src="https://braniii.github.io/prettypyplot/gallery/comparison/default_plot_legend.png" width="350">
        </td>
    </tr>
    <tr width="700" valign="top">
        <td>
            <code>matplotlib.pyplot.imshow</code><br>
            <img src="https://braniii.github.io/prettypyplot/gallery/comparison/mpl_imshow.png" width="350">
        </td>
        <td>
            <code>prettypyplot.imshow</code><br>
            <img src="https://braniii.github.io/prettypyplot/gallery/comparison/default_imshow.png" width="350">
        </td>
    </tr>
    <tr width="700" valign="top">
        <td>
            <code>matplotlib.pyplot.colorbar</code><br>
            <img src="https://braniii.github.io/prettypyplot/gallery/comparison/mpl_imshow_cbar.png" width="350">
        </td>
        <td>
            <code>prettypyplot.colorbar</code><br>
            <img src="https://braniii.github.io/prettypyplot/gallery/comparison/default_imshow_cbar.png" width="350">
        </td>
    </tr>
</table>

## Roadmap:

The following list is sorted from *near future* to *hopefully ever*.

- [x] add pytest
- [x] add search functionality in doc
- [x] refactoring code to improve readabilty
- [x] add package to conda_forge
- [x] add gallery page
- [x] improve `plt.suplots()` behaviour together with `pplt.savefig()`
- [ ] add more colorpalettes
- [ ] add countour line plot
- [ ] add [axes_grid](https://matplotlib.org/3.1.1/tutorials/toolkits/axes_grid.html) examples
- [ ] setup widths and scaling factors for beamer and poster mode
- [ ] tweak all function to enable `STYLE='minimal'`
- [ ] implement tufte style

## Building Documentation:

The doc is based on [mkdocs](https://mkdocs.org) and can be created by
```bash
# installing all dependencies
python -m pip install -e .[docs]

# serve interactively
python -m mkdocs serve
```

## Similar Projects

- [seaborn](https://seaborn.pydata.org/)

## Citing Prettypyplot

If you want to cite prettypyplot in scientific work please use:
> **Prettypyplot: publication ready matplotlib figures made simple**
> D. Nagel, **2022**. Zenodo:
> [10.5281/zenodo.7278312](https://doi.org/10.5281/zenodo.7278312)

## Credits:

In alphabetical order:

- [colorcyclepicker](https://colorcyclepicker.mpetroff.net/)
- [coolors](https://coolors.co/)
- [matplotlib](https://matplotlib.org/)
- [prettyplotlib](https://github.com/olgabot/prettyplotlib)
- [realpython](https://realpython.com/)
- [viscm](https://github.com/matplotlib/viscm)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/braniii/prettypyplot",
    "name": "prettypyplot",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "matplotlib pyplot",
    "author": "braniii",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/49/d3/2f527506b11058938535e00cdf31a8a9190ccafad88834d566b0f0a4c75d/prettypyplot-0.11.0.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  <img\n    src=\"https://raw.githubusercontent.com/braniii/prettypyplot/main/docs/gallery/images/logo_large.svg\" width=\"500\"\n  />\n\n  <p>\n    <a href=\"https://zenodo.org/badge/latestdoi/350406950\" alt=\"DOI\">\n        <img src=\"https://zenodo.org/badge/350406950.svg\" alt=\"DOI\" /></a>\n    <a href=\"https://github.com/wemake-services/wemake-python-styleguide\" alt=\"wemake-python-styleguide\" >\n        <img src=\"https://img.shields.io/badge/style-wemake-000000.svg\" /></a>\n    <a href=\"https://github.com/braniii/prettypyplot/actions/workflows/pytest.yml\" alt=\"Pytest\" >\n        <img src=\"https://github.com/braniii/prettypyplot/actions/workflows/pytest.yml/badge.svg?branch=main\" /></a>\n    <a href=\"https://codecov.io/gh/braniii/prettypyplot\" alt=\"Code coverage\">\n        <img src=\"https://codecov.io/gh/braniii/prettypyplot/branch/main/graph/badge.svg\" /></a>\n    <a href=\"https://pypi.org/project/prettypyplot\" alt=\"PyPI\" >\n        <img src=\"https://img.shields.io/pypi/v/prettypyplot\" /></a>\n    <a href=\"https://anaconda.org/conda-forge/prettypyplot\" alt=\"conda version\">\n        <img src=\"https://img.shields.io/conda/vn/conda-forge/prettypyplot\" /></a>\n    <a href=\"https://pepy.tech/project/prettypyplot\" alt=\"Downloads\" >\n        <img src=\"https://pepy.tech/badge/prettypyplot\" /></a>\n    <a href=\"https://img.shields.io/pypi/pyversions/prettypyplot\" alt=\"PyPI - Python Version\">\n        <img src=\"https://img.shields.io/pypi/pyversions/prettypyplot\" /></a>\n    <a href=\"https://github.com/braniii/prettypyplot/-/blob/main/LICENSE\" alt=\"PyPI - License\" >\n        <img src=\"https://img.shields.io/pypi/l/prettypyplot\" /></a>\n    <a href=\"https://braniii.github.io/prettypyplot\" alt=\"Doc\" >\n        <img src=\"https://img.shields.io/badge/mkdocs-Documentation-brightgreen\" /></a>\n  </p>\n\n  <p>\n    <a href=\"https://braniii.github.io/prettypyplot\">Docs</a> \u2022\n    <a href=\"#features\">Features</a> \u2022\n    <a href=\"#Installation\">Installation</a> \u2022\n    <a href=\"https://braniii.github.io/prettypyplot/gallery\">Gallery</a>\n  </p>\n</div>\n\n\n\n# prettypyplot\n\nThe documentation including an gallery can be found [here](https://braniii.github.io/prettypyplot).\n\nThis is a wrapper package for matplotlib to achieve more easily pretty figures.\nIf you are looking for something complete, this project is nothing for you\nbut maybe [seaborn](https://seaborn.pydata.org/). The main aspect of this\nproject is to help me syncing my rcParams files and to stop copy-pasting so\nmuch code.\n\nThe aim of this project is to simplify the generation of some simple\npre-defined figures. Almost all code is inspired or taken from the\n[matplotlib gallery](https://matplotlib.org/gallery/index.html). If you are a\npower user or interested in generating complex figures, this packages is not\nment for you and you should better take a look in the matplotlib gallery\ndirectly.\n\nThis project is in an alpha stage, hence it is neither stable nor ready for\nproduction.\n> **CAUTION**:\n> Starting from version 1.0.0 (which is far in the future) API-breaking\n> changes will be made only in major releases. Until then, it can be changed\n> in every minor release (see [changelog](#changelog)).\n\n## Features\n\nThe most notable features are:\n\n- Tested with matplotlib `3.2`-`3.8`\n- figsize specifies size of canvas. So labels, ticks or colorbars are not counted.\n- Nice top-aligned outter legends\n- New colors\n\n## Usage\n\nThis package uses an syntax very close to matplotlib. Hence, it should be\nstraight forward to use it. Instead of calling a function on the axes itself,\none needs to pass here the axes as an argument (args or kwargs).\n\n### Installation\n\n```python\npython3 -m pip install --upgrade prettypyplot\n```\nor\n```python\nconda install -c conda-forge prettypyplot\n```\nor for the latest dev version\n```python\npython3 -m pip install git+https://github.com/braniii/prettypyplot.git\n```\n\n### Usage\n\n```python\nimport matplotlib.pyplot as plt\nimport prettypyplot as pplt\n\npplt.use_style()\nfig, ax = plt.subplots()\n...\npplt.plot(ax=ax, x, y)\npplt.savefig(output)\n```\n\n### Known Bugs\n\n- `plt.subplots_adjust()` does not work with `pplt.savefig(use_canvas_size=True)`\nIf you find one, please open an issue.\n- `pplt.savefig(use_canvas_size=True)` is not compatible with a grid of subplots\n\n### Known Workarounds\n\nThe method `pyplot.subplots_adjust()` is not compatible with the option\n`use_canvas_size` in `prettypyplot.plot.savefig`,\nuse instead:\n```python\n# this doesn't work, use instead gridspec\nfig.subplots_adjust(hspace=0)\n# use this instead\nfig, axs = plt.subplots(..., gridspec_kw={'hspace': 0.000})\n```\n\n## Comparison to `matplotlib`\n\n<table>\n    <tr width=\"700\" valign=\"top\">\n        <td>\n            <code>matplotlib.pyplot.plot</code><br>\n            <img src=\"https://braniii.github.io/prettypyplot/gallery/comparison/mpl_plot.png\" width=\"350\">\n        </td>\n        <td>\n            <code>prettypyplot.plot</code><br>\n            <img src=\"https://braniii.github.io/prettypyplot/gallery/comparison/default_plot.png\" width=\"350\">\n        </td>\n    </tr>\n    <tr width=\"700\" valign=\"top\">\n        <td>\n            <code>matplotlib.pyplot.legend</code><br>\n            <img src=\"https://braniii.github.io/prettypyplot/gallery/comparison/mpl_plot_legend.png\" width=\"350\">\n        </td>\n        <td>\n            <code>prettypyplot.legend</code><br>\n            <img src=\"https://braniii.github.io/prettypyplot/gallery/comparison/default_plot_legend.png\" width=\"350\">\n        </td>\n    </tr>\n    <tr width=\"700\" valign=\"top\">\n        <td>\n            <code>matplotlib.pyplot.imshow</code><br>\n            <img src=\"https://braniii.github.io/prettypyplot/gallery/comparison/mpl_imshow.png\" width=\"350\">\n        </td>\n        <td>\n            <code>prettypyplot.imshow</code><br>\n            <img src=\"https://braniii.github.io/prettypyplot/gallery/comparison/default_imshow.png\" width=\"350\">\n        </td>\n    </tr>\n    <tr width=\"700\" valign=\"top\">\n        <td>\n            <code>matplotlib.pyplot.colorbar</code><br>\n            <img src=\"https://braniii.github.io/prettypyplot/gallery/comparison/mpl_imshow_cbar.png\" width=\"350\">\n        </td>\n        <td>\n            <code>prettypyplot.colorbar</code><br>\n            <img src=\"https://braniii.github.io/prettypyplot/gallery/comparison/default_imshow_cbar.png\" width=\"350\">\n        </td>\n    </tr>\n</table>\n\n## Roadmap:\n\nThe following list is sorted from *near future* to *hopefully ever*.\n\n- [x] add pytest\n- [x] add search functionality in doc\n- [x] refactoring code to improve readabilty\n- [x] add package to conda_forge\n- [x] add gallery page\n- [x] improve `plt.suplots()` behaviour together with `pplt.savefig()`\n- [ ] add more colorpalettes\n- [ ] add countour line plot\n- [ ] add [axes_grid](https://matplotlib.org/3.1.1/tutorials/toolkits/axes_grid.html) examples\n- [ ] setup widths and scaling factors for beamer and poster mode\n- [ ] tweak all function to enable `STYLE='minimal'`\n- [ ] implement tufte style\n\n## Building Documentation:\n\nThe doc is based on [mkdocs](https://mkdocs.org) and can be created by\n```bash\n# installing all dependencies\npython -m pip install -e .[docs]\n\n# serve interactively\npython -m mkdocs serve\n```\n\n## Similar Projects\n\n- [seaborn](https://seaborn.pydata.org/)\n\n## Citing Prettypyplot\n\nIf you want to cite prettypyplot in scientific work please use:\n> **Prettypyplot: publication ready matplotlib figures made simple**\n> D. Nagel, **2022**. Zenodo:\n> [10.5281/zenodo.7278312](https://doi.org/10.5281/zenodo.7278312)\n\n## Credits:\n\nIn alphabetical order:\n\n- [colorcyclepicker](https://colorcyclepicker.mpetroff.net/)\n- [coolors](https://coolors.co/)\n- [matplotlib](https://matplotlib.org/)\n- [prettyplotlib](https://github.com/olgabot/prettyplotlib)\n- [realpython](https://realpython.com/)\n- [viscm](https://github.com/matplotlib/viscm)\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License",
    "summary": "Wrapper for matplotlib to generate pretty plots.",
    "version": "0.11.0",
    "project_urls": {
        "Homepage": "https://github.com/braniii/prettypyplot"
    },
    "split_keywords": [
        "matplotlib",
        "pyplot"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9d6af8f6e6204a1d682d479f967ba42ebc8a3635b5e9a4ef10c79f25595ad888",
                "md5": "a4f6b92309c9cee27ed474cdabe1cf1b",
                "sha256": "c14829226b472ea799434a80c65f148536463c065450a0835c990006aa96f5bc"
            },
            "downloads": -1,
            "filename": "prettypyplot-0.11.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a4f6b92309c9cee27ed474cdabe1cf1b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 38988,
            "upload_time": "2024-05-30T11:41:01",
            "upload_time_iso_8601": "2024-05-30T11:41:01.387219Z",
            "url": "https://files.pythonhosted.org/packages/9d/6a/f8f6e6204a1d682d479f967ba42ebc8a3635b5e9a4ef10c79f25595ad888/prettypyplot-0.11.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "49d32f527506b11058938535e00cdf31a8a9190ccafad88834d566b0f0a4c75d",
                "md5": "afa11ce42baf1b3e57357b7b9e31baa3",
                "sha256": "54886789899ea9f6eb4d7427fc68042f80bf9679711e9b037c95ea424271e304"
            },
            "downloads": -1,
            "filename": "prettypyplot-0.11.0.tar.gz",
            "has_sig": false,
            "md5_digest": "afa11ce42baf1b3e57357b7b9e31baa3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 43028,
            "upload_time": "2024-05-30T11:41:06",
            "upload_time_iso_8601": "2024-05-30T11:41:06.584853Z",
            "url": "https://files.pythonhosted.org/packages/49/d3/2f527506b11058938535e00cdf31a8a9190ccafad88834d566b0f0a4c75d/prettypyplot-0.11.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-30 11:41:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "braniii",
    "github_project": "prettypyplot",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "matplotlib",
            "specs": [
                [
                    ">=",
                    "3.0.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "decorit",
            "specs": [
                [
                    ">=",
                    "0.2.0"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "prettypyplot"
}
        
Elapsed time: 0.27965s