You are reading an old version of the documentation (v3.0.0). For the latest version see https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.matshow.html
Version 3.0.0
matplotlib
Fork me on GitHub

Table Of Contents

matplotlib.axes.Axes.matshow

Axes.matshow(Z, **kwargs)[source]

Plot the values of a 2D matrix or array as color-coded image.

The matrix will be shown the way it would be printed, with the first row at the top. Row and column numbering is zero-based.

Parameters:
Z : array-like(M, N)

The matrix to be displayed.

Returns:
image : AxesImage
Other Parameters:
**kwargs : imshow arguments

See also

imshow
More general function to plot data on a 2D regular raster.

Notes

This is just a convenience function wrapping imshow to set useful defaults for a displaying a matrix. In particular:

  • Set origin='upper'.
  • Set interpolation='nearest'.
  • Set aspect='equal'.
  • Ticks are placed to the left and above.
  • Ticks are formatted to show integer indices.

Examples using matplotlib.axes.Axes.matshow