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

Uploaded Source

Built Distribution

mpl_fill_cmap_between-0.3.0-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mpl_fill_cmap_between-0.3.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.10.6 Linux/5.19.0-38-generic

File hashes

Hashes for mpl_fill_cmap_between-0.3.0.tar.gz
Algorithm Hash digest
SHA256 59405085da6663dfbd2afa3c1596d16ad7a297552442d98a8bef7f7d6ff9c6ea
MD5 7df96c3e08e48ce10f0465e88b72cae3
BLAKE2b-256 487351440f77c646d6bcfc3edd1e3c66d19a88cc7bce0a9421522017b0d8d327

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for mpl_fill_cmap_between-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76cc09b340b2f6c765c040e0691d0f7fcb6214e0e1b50f5f77a04dfb72d3f221
MD5 f6a847e54d82d5ee6fa75b11c506a346
BLAKE2b-256 aa13a97cf834b5331c024781ddb2929de7956d07be0e03986c874847777c69ef

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