Clean matplotlib plots
Project description
This package creates clean and beautiful plots that work on light and dark backgrounds. Inspired by the work of Edward Tufte.
To use, simply select the dufte
style. Check out dufte.legend()
and
dufte.ylabel()
for more duftness.
import matplotlib.pyplot as plt
import dufte
import numpy as np
plt.style.use(dufte.style)
np.random.seed(0)
x0 = np.linspace(0.0, 3.0, 100)
y0 = x0 / (x0 + 1)
y0 += 0.1 * np.random.rand(len(y0))
plt.plot(x0, y0, label="no balacing")
x1 = np.linspace(0.0, 3.0, 100)
y1 = 1.5 * x1 / (x1 + 1)
y1 += 0.1 * np.random.rand(len(y1))
plt.plot(x1, y1, label="CRV-27")
x2 = np.linspace(0.0, 3.0, 100)
y2 = 1.6 * x2 / (x2 + 1)
y2 += 0.1 * np.random.rand(len(y2))
plt.plot(x2, y2, label="CRV-27*")
dufte.ylabel("ylabel")
dufte.legend()
plt.show()
Further reading:
Projects using dufte:
Background
The position $x_i
$ of the line annotations is computed as the solution of a
non-negative least-squares problem
\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.
Testing
To run the dufte unit tests, check out this repository and type
pytest
License
This software is published under the GPLv3 license.
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
dufte-0.2.21.tar.gz
(18.8 kB
view hashes)
Built Distribution
dufte-0.2.21-py3-none-any.whl
(18.9 kB
view hashes)