
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "plot_types/unstructured/tricontourf.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_unstructured_tricontourf.py>`
        to download the full example code.

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

.. _sphx_glr_plot_types_unstructured_tricontourf.py:


====================
tricontourf(x, y, z)
====================
Draw contour regions on an unstructured triangular grid.

See `~matplotlib.axes.Axes.tricontourf`.

.. GENERATED FROM PYTHON SOURCE LINES 9-30



.. image-sg:: /plot_types/unstructured/images/sphx_glr_tricontourf_001.png
   :alt: tricontourf
   :srcset: /plot_types/unstructured/images/sphx_glr_tricontourf_001.png, /plot_types/unstructured/images/sphx_glr_tricontourf_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:
    np.random.seed(1)
    x = np.random.uniform(-3, 3, 256)
    y = np.random.uniform(-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.plot(x, y, 'o', markersize=2, color='grey')
    ax.tricontourf(x, y, z, levels=levels)

    ax.set(xlim=(-3, 3), ylim=(-3, 3))

    plt.show()


.. _sphx_glr_download_plot_types_unstructured_tricontourf.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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