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)
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)
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
Built Distribution
File details
Details for the file mpl_fill_cmap_between-0.3.1.tar.gz
.
File metadata
- Download URL: mpl_fill_cmap_between-0.3.1.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e8f9ac1caa0e96cfba355fb0a7aec9ddd0882a2990559ac1e602a1e4945665a |
|
MD5 | 3246c571b7136c44865fdb4b17cb5b3f |
|
BLAKE2b-256 | e0e2bc3eb91066c305a4614f0c44e2d78cd900a82ad74a7dcfacaaa7bff2f4b1 |
File details
Details for the file mpl_fill_cmap_between-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: mpl_fill_cmap_between-0.3.1-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.10.6 Linux/5.19.0-38-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 842d48923a0481b155a7f735b867fd168ed0343b91316ba6261b14dd7c4eca8f |
|
MD5 | ce96a3658d432a4440ad49e4b3153405 |
|
BLAKE2b-256 | 174feec39fbd5be6c4e697a46e1989f931055bb2f4fea227f3d66459ca8edea6 |