Skip to main content

Create fillbetween plots filled with any colormap

Project description

mpl_fill_cmap_between

Create fill_between-like plots filled with any matplotlib's colormap.

Install

pip install mpl_fill_cmap_between

Examples

The function fill_cmap_between (and also the function fill_cmap_between_x) can be used in the following manner:

import numpy as np
import matplotlib.pyplot as plt
from mpl_fill_cmap_between import fill_cmap_between, fill_cmap_between_x

x = np.linspace(-10, 10, 50)
y = x**2 - 40

fig = plt.figure(figsize=(4.8, 2.0))
ax = fig.add_subplot(111)

fill_cmap_between(x, y * 0.1, 0, ax=ax, cmap="viridis", kw_line_1=dict(color="k"),
                  kw_line_2=dict(color="k", lw=0.5))
ax.set_aspect("equal")

fig.tight_layout()
fig.savefig("example.pdf", dpi=300)

Example

The plot can also be rotated by an angle from a given origin:

import numpy as np
import matplotlib.pyplot as plt
from mpl_fill_cmap_between import fill_cmap_between, fill_cmap_between_x

x = np.linspace(0, 10, 50)
y = (x - 5)**2 - 10

fig = plt.figure(figsize=(4.8, 2.0))
ax = fig.add_subplot(111)

fill_cmap_between(x, y * 0.1, 0, ax=ax, cmap="viridis", kw_line_1=dict(color="k"),
                  kw_line_2=dict(color="k", lw=0.5), angle=40, origin=(10, 0))
ax.set_aspect("equal")
ax.grid(True, ls=":")

fig.tight_layout()
fig.savefig("example_02.png", dpi=300)

Example

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

mpl_fill_cmap_between-0.2.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

mpl_fill_cmap_between-0.2.1-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file mpl_fill_cmap_between-0.2.1.tar.gz.

File metadata

  • Download URL: mpl_fill_cmap_between-0.2.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0 CPython/3.10.4 Linux/5.15.0-47-generic

File hashes

Hashes for mpl_fill_cmap_between-0.2.1.tar.gz
Algorithm Hash digest
SHA256 da4655ff9f8914d757dc086c68360c59f4dd2de83b73861d3808d759a1c56567
MD5 7da19de915e57f0ecc0ffdd0d6bc62c4
BLAKE2b-256 f041b7ac8f2c681aa76bfd83be6ae40ff3ab5ce5c6c4026e150e9e1ecf963811

See more details on using hashes here.

Provenance

File details

Details for the file mpl_fill_cmap_between-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mpl_fill_cmap_between-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6e6ca134ebd934f9472628222968cd07389fcbdbcd2794717b2f4aa531471248
MD5 21302bc4801f43ba3aaa6559c6742184
BLAKE2b-256 02430138228610f14b72e5b800a868f6d4fc598ccd586a474ce19e2c0dff354b

See more details on using hashes here.

Provenance

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