https://github.com/nschloe/dufte
:chart_with_upwards_trend: Minimalistic Matplotlib style
https://github.com/nschloe/dufte
matplotlib matplotlib-style-sheets matplotlib-styles plotting python
Last synced: about 1 month ago
JSON representation
:chart_with_upwards_trend: Minimalistic Matplotlib style
- Host: GitHub
- URL: https://github.com/nschloe/dufte
- Owner: nschloe
- License: mit
- Archived: true
- Created: 2020-04-19T13:13:53.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-12-02T12:22:02.000Z (almost 4 years ago)
- Last Synced: 2024-11-06T03:05:44.650Z (about 1 year ago)
- Topics: matplotlib, matplotlib-style-sheets, matplotlib-styles, plotting, python
- Language: Python
- Homepage:
- Size: 2.02 MB
- Stars: 216
- Watchers: 5
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Deprecation
dufte as a stand-alone module has been deprecated and merged into [mplx](https://github.com/nschloe/mplx).
---
[](https://pypi.org/project/dufte/)
[](https://anaconda.org/conda-forge/dufte/)
[](https://pypi.org/project/dufte/)
[](https://github.com/nschloe/dufte)
[](https://pepy.tech/project/dufte)
[](https://github.com/nschloe/dufte/actions?query=workflow%3Aci)
[](https://codecov.io/gh/nschloe/dufte)
[](https://lgtm.com/projects/g/nschloe/dufte)
[](https://github.com/psf/black)
This package creates clean and beautiful plots that work on light and dark backgrounds.
Inspired by the work of [Edward Tufte](https://en.wikipedia.org/wiki/Edward_Tufte).
To use, install with
```
pip install dufte
```
and simply select the `dufte` style:
```python
import dufte
import matplotlib.pyplot as plt
# global setting:
plt.style.use(dufte.style)
# with a context manager:
with plt.style.context(dufte.style_bar):
# ...
pass
```
Check out `dufte.legend()`, `dufte.ylabel()`, and `dufte.show_bar_values()` for more
duftiness.
#### Comparison with default Matplotlib
See [here](tests/create_comparison.py) for how to create the below plots.
matplotlib
dufte with dufte.legend()
matplotlib
dufte
dufte with dufte.show_bar_values()
### Further reading and other styles
- [Remove to improve: data-ink ratio](https://www.darkhorseanalytics.com/blog/data-looks-better-naked)

- [Remove to improve: Line Graph Edition](https://youtu.be/bDbJBWvonVI)
- [Show the Data - Maximize the Data Ink Ratio](https://youtu.be/pCp0a5_YIWE)
- [Randal S. Olson's blog entry](http://www.randalolson.com/2014/06/28/how-to-make-beautiful-data-visualizations-in-python-with-matplotlib/)
- [prettyplotlib](https://github.com/olgabot/prettyplotlib)
- [Wikipedia: Chartjunk](https://en.wikipedia.org/wiki/Chartjunk)
Other styles
- [John Garrett, _Science Plots_](https://github.com/garrettj403/SciencePlots)
- [Dominik Haitz, _Cyberpunk style_](https://github.com/dhaitz/mplcyberpunk)
- [Dominik Haitz, _Matplotlib stylesheets_](https://github.com/dhaitz/matplotlib-stylesheets)
- [Carlos da Costa, _The Grand Budapest Hotel_](https://github.com/cako/mpl_grandbudapest)
- [Danny Antaki, _vaporwave aesthetics_](https://github.com/dantaki/vapeplot)
- [QuantumBlack Labs, _QuantumBlack_](https://github.com/quantumblacklabs/qbstyles)
Projects using dufte:
- [perfplot](https://github.com/nschloe/perfplot)
- [stargraph](https://github.com/nschloe/stargraph)
### Background
[](https://chrome.google.com/webstore/detail/xdoc/anidddebgkllnnnnjfkmjcaallemhjee)
The position $`x_i`$ of the line annotations is computed as the solution of a
non-negative least-squares problem
```math
\begin{align}
\frac{1}{2}\sum_i (x_i - t_i)^2 \to \min_x,\\
(x_i - x_j)^2 \ge a^2 \quad \forall i,j.
\end{align}
```
where $`a`$ is the minimum distance between two entries and $`t_i`$ is the target
position.