[ Web Proxy ]
URL:
Viewing: https://matplotlib.org/gallery/mplot3d/../axes_grid1/../../plot_types/basic/../arrays/contourf.html [Back]  [Original]

contourf(X, Y, Z) — Matplotlib 3.11.2 documentation
Back to top
Search the docs ...:

contourf(X, Y, Z)#

Plot filled contours.

See contourf.

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

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

# make data
X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256))
Z = (1 - X/2 + X**5 + Y**3) * np.exp(-X**2 - Y**2)
levels = np.linspace(Z.min(), Z.max(), 7)

# plot
fig, ax = plt.subplots()

ax.contourf(X, Y, Z, levels=levels)

plt.show()

Gallery generated by Sphinx-Gallery


Web Proxy Viewer  |  New URL  |  Original Page