[ Web Proxy ]
URL:
Viewing: https://matplotlib.org/devdocs/api/toolkits/../../plot_types/stats/../3D/../arrays/pcolormesh.html [Back]  [Original]

pcolormesh(X, Y, Z) — Matplotlib 3.12.0.dev738+ge3fc0dad9 documentation
Back to top
Search the docs ...:

pcolormesh(X, Y, Z)#

Create a pseudocolor plot with a non-regular rectangular grid.

pcolormesh is more flexible than imshow in that the x and y vectors need not be equally spaced (indeed they can be skewed).

pcolormesh [pcolormesh]
import matplotlib.pyplot as plt
import numpy as np

plt.style.use('_mpl-gallery-nogrid')

# make data with uneven sampling in x
x = [-3, -2, -1.6, -1.2, -.8, -.5, -.2, .1, .3, .5, .8, 1.1, 1.5, 1.9, 2.3, 3]
X, Y = np.meshgrid(x, np.linspace(-3, 3, 128))
Z = (1 - X/2 + X**5 + Y**3) * np.exp(-X**2 - Y**2)

# plot
fig, ax = plt.subplots()

ax.pcolormesh(X, Y, Z, vmin=-0.5, vmax=1.0)

plt.show()

Gallery generated by Sphinx-Gallery


Web Proxy Viewer  |  New URL  |  Original Page