
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/images_contours_and_fields/matshow.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        Click :ref:`here <sphx_glr_download_gallery_images_contours_and_fields_matshow.py>`
        to download the full example code

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gallery_images_contours_and_fields_matshow.py:


=======
Matshow
=======

`~.axes.Axes.matshow` visualizes a 2D matrix or array as color-coded image.

.. GENERATED FROM PYTHON SOURCE LINES 8-18

.. code-block:: default

    import matplotlib.pyplot as plt
    import numpy as np

    # a 2D array with linearly increasing values on the diagonal
    a = np.diag(range(15))

    plt.matshow(a)

    plt.show()




.. image:: /gallery/images_contours_and_fields/images/sphx_glr_matshow_001.png
    :alt: matshow
    :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 19-26

------------

References
""""""""""

The use of the following functions and methods is shown
in this example:

.. GENERATED FROM PYTHON SOURCE LINES 27-31

.. code-block:: default


    import matplotlib
    matplotlib.axes.Axes.matshow
    matplotlib.pyplot.matshow




.. rst-class:: sphx-glr-script-out

 Out:

 .. code-block:: none


    <function matshow at 0x7f73be8160d0>




.. _sphx_glr_download_gallery_images_contours_and_fields_matshow.py:


.. only :: html

 .. container:: sphx-glr-footer
    :class: sphx-glr-footer-example



  .. container:: sphx-glr-download sphx-glr-download-python

     :download:`Download Python source code: matshow.py <matshow.py>`



  .. container:: sphx-glr-download sphx-glr-download-jupyter

     :download:`Download Jupyter notebook: matshow.ipynb <matshow.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    Keywords: matplotlib code example, codex, python plot, pyplot
    `Gallery generated by Sphinx-Gallery
    <https://sphinx-gallery.readthedocs.io>`_
