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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: mpl_fill_cmap_between-0.2.0.tar.gz
  • Upload date:
  • Size: 2.8 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.0.tar.gz
Algorithm Hash digest
SHA256 a4e02e0b41201e82435dd9252f1150090f2af91c7ee033953a757bec0ca55530
MD5 18abaa7daf8b418f8e4d4657ded21a89
BLAKE2b-256 91acd6dd81af81315a5bd4f1c0271546b8aa9fb0d7099c1176c8e676c024a3f2

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for mpl_fill_cmap_between-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3db21b0191d80658bf778548dcb63aa08d3b0c95585b7a0e0a8de6572c3b98ab
MD5 070aec9875fbc34e2a9e9619bb4e5e92
BLAKE2b-256 bcbeb7fd2869b5253d2e37c806d37d4a5a55f8c0e93a80a95f53966d3e0f3e0e

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