Skip to main content

Clean matplotlib plots

Project description

dufte-logo

Da kiekste, wa?

PyPi Version Anaconda Cloud PyPI pyversions GitHub stars PyPi downloads

gh-actions codecov LGTM Code style: black

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:

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 for how to create the below plots.

matplotlib dufte with dufte.legend()
matplotlib dufte dufte with dufte.show_bar_values()

Further reading:

Projects using dufte:

Background

xdoc

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

Project details


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.27.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dufte-0.2.27-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file dufte-0.2.27.tar.gz.

File metadata

  • Download URL: dufte-0.2.27.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for dufte-0.2.27.tar.gz
Algorithm Hash digest
SHA256 56924d2faf40921af0f888c29efedfe62c776db3b7a677961779886e99f80288
MD5 571588f7f1ac914381644c13be1e97c7
BLAKE2b-256 a1628ca9e03e5a5246ee6d90f123745a679293c49cfcdc2cc84879dd4d368fe2

See more details on using hashes here.

File details

Details for the file dufte-0.2.27-py3-none-any.whl.

File metadata

  • Download URL: dufte-0.2.27-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for dufte-0.2.27-py3-none-any.whl
Algorithm Hash digest
SHA256 5a34fe7e551adac6551ab612c17f4e008f0ec36377ce7c3cad1936de43961b26
MD5 8719bba1ce19b9b41a897297e3fb3547
BLAKE2b-256 2c46cfc786d49960513686cf8916630dc57cfc1fee6271970869c672d329da72

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page