| [ Web Proxy ] |
| Viewing: https://matplotlib.org/stable/api/_as_gen/../../devel/MEP/../../plot_types/arrays/contour.html | [Back] [Original] |
Note
Go to the end to download the full example code.
Plot contour lines.
See contour.
[contour]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(np.min(Z), np.max(Z), 7)
# plot
fig, ax = plt.subplots()
ax.contour(X, Y, Z, levels=levels)
plt.show()
| Web Proxy Viewer | New URL | Original Page |