Wrapper for matplotlib to generate pretty plots.
Project description
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. 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. 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).
Features
The most notable features are:
- 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).
Usage
import matplotlib.pyplot as plt
import prettypyplot as pplt
pplt.setup_pyplot()
fig, ax = plt.subplots()
...
pplt.plot(ax=ax, x, y)
pplt.savefig(output)
Known Bugs
plt.subplots_adjust()
does not work withpplt.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:
# 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
matplotlib.pyplot.plot |
prettypyplot.plot |
matplotlib.pyplot.legend |
prettypyplot.legend |
matplotlib.pyplot.imshow |
prettypyplot.imshow |
matplotlib.pyplot.colorbar |
prettypyplot.colorbar |
Changelog and Roadmap:
Changelog
- tba:
- added gallery
- refactored all submodules
- added docs
- many small bugfixes
- v0.1:
- intial release
Roadmap:
The following list is sorted from near future to hopefully ever.
- enforce simplicity by refactoring
- add countour line plot
- add axes_grid examples
- add more gallery entries
- improve
plt.suplots()
behaviour together withpplt.savefig()
- setup widths and scaling factors for beamer and poster mode
- tweak all function to enable
STYLE='minimal'
- create own logo
- add pytest
- add search functionality in doc
- implement tufte style
Building Documentation:
The doc is based on pdoc and can be created by
simply running bash create_doc.sh
from the docs folder.
Similar Projects
Credits:
In alphabetical order:
Project details
Release history Release notifications | RSS feed
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
Hashes for prettypyplot-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d38d01ec7d0ef43b6bfa5304e116703bd5a865ab6e8d058cc445dbb49e546987 |
|
MD5 | 6a01aace632ca5fc1123c957ab72a839 |
|
BLAKE2b-256 | ba4ec865af43dab9c3b635b14f3dd627ef2ed100f621236313e1de414ae28adc |