Skip to main content
Ctrl+K
Logo image
  • Plot types
  • Examples
  • Tutorials
  • Reference
  • User guide
  • Develop
  • Releases
  • Plot types
  • Examples
  • Tutorials
  • Reference
  • User guide
  • Develop
  • Releases

Section Navigation

  • Basic
    • plot(x, y)
    • scatter(x, y)
    • bar(x, height)
    • stem(x, y)
    • step(x, y)
    • fill_between(x, y1, y2)
    • stackplot(x, y)
  • Plots of arrays and fields
    • imshow(Z)
    • pcolormesh(X, Y, Z)
    • contour(X, Y, Z)
    • contourf(X, Y, Z)
    • barbs(X, Y, U, V)
    • quiver(X, Y, U, V)
    • streamplot(X, Y, U, V)
  • Statistics plots
    • hist(x)
    • boxplot(X)
    • errorbar(x, y, yerr, xerr)
    • violinplot(D)
    • eventplot(D)
    • hist2d(x, y)
    • hexbin(x, y, C)
    • pie(x)
    • ecdf(x)
  • Unstructured coordinates
    • tricontour(x, y, z)
    • tricontourf(x, y, z)
    • tripcolor(x, y, z)
    • triplot(x, y)
  • 3D
    • 3D scatterplot
    • 3D surface
    • Triangular 3D surfaces
    • 3D voxel / volumetric plot
    • 3D wireframe plot
  • Plot types
  • Plots of arrays and fields
  • imshow(Z)

Note

Go to the end to download the full example code

imshow(Z)#

See imshow.

imshow
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, 16), np.linspace(-3, 3, 16))
Z = (1 - X/2 + X**5 + Y**3) * np.exp(-X**2 - Y**2)

# plot
fig, ax = plt.subplots()

ax.imshow(Z)

plt.show()

Download Python source code: imshow.py

Download Jupyter notebook: imshow.ipynb

Gallery generated by Sphinx-Gallery

© Copyright 2002–2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012–2023 The Matplotlib development team.

Created using Sphinx 5.3.0.

Built from v3.7.1-724-gc8aaa903df.

Built with the PyData Sphinx Theme 0.13.2.