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

.. only:: html

    .. meta::
        :keywords: codex

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

        :ref:`Go to the end <sphx_glr_download_plot_types_arrays_pcolormesh.py>`
        to download the full example code.

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

.. _sphx_glr_plot_types_arrays_pcolormesh.py:


===================
pcolormesh(X, Y, Z)
===================
Create a pseudocolor plot with a non-regular rectangular grid.

`~.axes.Axes.pcolormesh` is more flexible than `~.axes.Axes.imshow` in that
the x and y vectors need not be equally spaced (indeed they can be skewed).

.. GENERATED FROM PYTHON SOURCE LINES 11-27



.. image-sg:: /plot_types/arrays/images/sphx_glr_pcolormesh_001.png
   :alt: pcolormesh
   :srcset: /plot_types/arrays/images/sphx_glr_pcolormesh_001.png, /plot_types/arrays/images/sphx_glr_pcolormesh_001_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. code-block:: Python

    import matplotlib.pyplot as plt
    import numpy as np

    plt.style.use('_mpl-gallery-nogrid')

    # make data with uneven sampling in x
    x = [-3, -2, -1.6, -1.2, -.8, -.5, -.2, .1, .3, .5, .8, 1.1, 1.5, 1.9, 2.3, 3]
    X, Y = np.meshgrid(x, np.linspace(-3, 3, 128))
    Z = (1 - X/2 + X**5 + Y**3) * np.exp(-X**2 - Y**2)

    # plot
    fig, ax = plt.subplots()

    ax.pcolormesh(X, Y, Z, vmin=-0.5, vmax=1.0)

    plt.show()


.. _sphx_glr_download_plot_types_arrays_pcolormesh.py:

.. only:: html

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

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

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

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

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

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: pcolormesh.zip <pcolormesh.zip>`


.. only:: html

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

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
