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
Close
Hashes for mpl_fill_cmap_between-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4e02e0b41201e82435dd9252f1150090f2af91c7ee033953a757bec0ca55530 |
|
MD5 | 18abaa7daf8b418f8e4d4657ded21a89 |
|
BLAKE2b-256 | 91acd6dd81af81315a5bd4f1c0271546b8aa9fb0d7099c1176c8e676c024a3f2 |
Close
Hashes for mpl_fill_cmap_between-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3db21b0191d80658bf778548dcb63aa08d3b0c95585b7a0e0a8de6572c3b98ab |
|
MD5 | 070aec9875fbc34e2a9e9619bb4e5e92 |
|
BLAKE2b-256 | bcbeb7fd2869b5253d2e37c806d37d4a5a55f8c0e93a80a95f53966d3e0f3e0e |