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

.. only:: html

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

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

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

.. _sphx_glr_plot_types_arrays_contourf.py:


=================
contourf(X, Y, Z)
=================

See `~matplotlib.axes.Axes.contourf`.

.. GENERATED FROM PYTHON SOURCE LINES 8-24



.. image-sg:: /plot_types/arrays/images/sphx_glr_contourf_001.png
   :alt: contourf
   :srcset: /plot_types/arrays/images/sphx_glr_contourf_001.png, /plot_types/arrays/images/sphx_glr_contourf_001_2_0x.png 2.0x
   :class: sphx-glr-single-img





.. code-block:: default

    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()


.. _sphx_glr_download_plot_types_arrays_contourf.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: contourf.py <contourf.py>`



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

     :download:`Download Jupyter notebook: contourf.ipynb <contourf.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>`_
