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

.. only:: html

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

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

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

.. _sphx_glr_examples_contour.py:


Contour plots
=============

Picking contour plots is supported on Matplotlib≥3.8.

.. GENERATED FROM PYTHON SOURCE LINES 7-31



.. image-sg:: /examples/images/sphx_glr_contour_001.png
   :alt: contour
   :srcset: /examples/images/sphx_glr_contour_001.png
   :class: sphx-glr-single-img





.. code-block:: Python


    import numpy as np
    import matplotlib.pyplot as plt
    import mplcursors

    fig, axs = plt.subplots(2, 2, figsize=(10, 4), sharex=True, sharey=True)

    ii, jj = np.ogrid[:100, :100]
    img = np.cos(ii / 20) * np.sin(jj / 10)
    c = axs[0, 0].contour(img)
    fig.colorbar(c, orientation="horizontal")
    c = axs[0, 1].contourf(img)
    fig.colorbar(c, orientation="horizontal")

    ii, jj = np.random.rand(2, 1000) * 100
    img = np.cos(ii / 20) * np.sin(jj / 10)
    c = axs[1, 0].tricontour(jj, ii, img)
    fig.colorbar(c, orientation="horizontal")
    c = axs[1, 1].tricontourf(jj, ii, img)
    fig.colorbar(c, orientation="horizontal")

    mplcursors.cursor()

    plt.show()


.. _sphx_glr_download_examples_contour.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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