Skip to main content

Clean matplotlib plots

Project description

dufte-logo

Tufte-style plots from Berlin.

gh-actions Code style: black PyPI pyversions PyPi Version GitHub stars PyPi downloads

This package creates clean and beautiful plots that work on light and dark backgrounds.

Simply select the dufte style and, if desired, call dufte.legend() to get line annotations on the right.

import matplotlib.pyplot as plt
import dufte
import numpy

plt.style.use(dufte.style)

numpy.random.seed(0)

x0 = numpy.linspace(0.0, 3.0, 100)
y0 = x0 / (x0 + 1)
y0 += 0.1 * numpy.random.rand(len(y0))
plt.plot(x0, y0, "no balacing")

x1 = numpy.linspace(0.0, 3.0, 100)
y1 = 1.5 * x1 / (x1 + 1)
y1 += 0.1 * numpy.random.rand(len(y1))
plt.plot(x1, y1, "CRV-27")

x2 = numpy.linspace(0.0, 3.0, 100)
y2 = 1.6 * x2 / (x2 + 1)
y2 += 0.1 * numpy.random.rand(len(y2))
plt.plot(x2, y2, "CRV-27*")

dufte.legend()

plt.show()

Further reading:

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


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.5.tar.gz (5.5 kB view hashes)

Uploaded Source

Built Distribution

dufte-0.2.5-py3-none-any.whl (17.3 kB view hashes)

Uploaded Python 3

Supported by

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