:orphan:

.. _plot_types:

.. redirect-from:: /tutorials/basic/sample_plots

Plot types
==========

Overview of many common plotting commands provided by Matplotlib.

See the `gallery <../gallery/index.html>`_ for more examples and
the `tutorials page <../tutorials/index.html>`_ for longer examples.



.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. thumbnail-parent-div-close

.. raw:: html

    </div>


Pairwise data
-------------

Plots of pairwise :math:`(x, y)`, tabular :math:`(var\_0, \cdots, var\_n)`,
and functional :math:`f(x)=y` data.



.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See plot.">

.. only:: html

  .. image:: /plot_types/basic/images/thumb/sphx_glr_plot_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_basic_plot.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">plot(x, y)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See scatter.">

.. only:: html

  .. image:: /plot_types/basic/images/thumb/sphx_glr_scatter_plot_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_basic_scatter_plot.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">scatter(x, y)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See bar.">

.. only:: html

  .. image:: /plot_types/basic/images/thumb/sphx_glr_bar_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_basic_bar.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">bar(x, height)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See stem.">

.. only:: html

  .. image:: /plot_types/basic/images/thumb/sphx_glr_stem_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_basic_stem.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">stem(x, y)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See fill_between.">

.. only:: html

  .. image:: /plot_types/basic/images/thumb/sphx_glr_fill_between_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_basic_fill_between.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">fill_between(x, y1, y2)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See stackplot">

.. only:: html

  .. image:: /plot_types/basic/images/thumb/sphx_glr_stackplot_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_basic_stackplot.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">stackplot(x, y)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See stairs when plotting y between (x_i, x_{i+1}). For plotting y at x, see step.">

.. only:: html

  .. image:: /plot_types/basic/images/thumb/sphx_glr_stairs_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_basic_stairs.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">stairs(values)</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>


Statistical distributions
-------------------------

Plots of the distribution of at least one variable in a dataset. Some of these
methods also compute the distributions.



.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See hist.">

.. only:: html

  .. image:: /plot_types/stats/images/thumb/sphx_glr_hist_plot_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_stats_hist_plot.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">hist(x)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See boxplot.">

.. only:: html

  .. image:: /plot_types/stats/images/thumb/sphx_glr_boxplot_plot_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_stats_boxplot_plot.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">boxplot(X)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See errorbar.">

.. only:: html

  .. image:: /plot_types/stats/images/thumb/sphx_glr_errorbar_plot_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_stats_errorbar_plot.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">errorbar(x, y, yerr, xerr)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See violinplot.">

.. only:: html

  .. image:: /plot_types/stats/images/thumb/sphx_glr_violin_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_stats_violin.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">violinplot(D)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See eventplot.">

.. only:: html

  .. image:: /plot_types/stats/images/thumb/sphx_glr_eventplot_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_stats_eventplot.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">eventplot(D)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See hist2d.">

.. only:: html

  .. image:: /plot_types/stats/images/thumb/sphx_glr_hist2d_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_stats_hist2d.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">hist2d(x, y)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See hexbin.">

.. only:: html

  .. image:: /plot_types/stats/images/thumb/sphx_glr_hexbin_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_stats_hexbin.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">hexbin(x, y, C)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See pie.">

.. only:: html

  .. image:: /plot_types/stats/images/thumb/sphx_glr_pie_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_stats_pie.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">pie(x)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See ecdf.">

.. only:: html

  .. image:: /plot_types/stats/images/thumb/sphx_glr_ecdf_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_stats_ecdf.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">ecdf(x)</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>


Gridded data
------------

Plots of arrays and images :math:`Z_{i, j}` and fields :math:`U_{i, j}, V_{i, j}`
on `regular grids <https://en.wikipedia.org/wiki/Regular_grid>`_ and
corresponding coordinate grids :math:`X_{i,j}, Y_{i,j}`.



.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See imshow.">

.. only:: html

  .. image:: /plot_types/arrays/images/thumb/sphx_glr_imshow_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_arrays_imshow.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">imshow(Z)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="pcolormesh is more flexible than imshow in that the x and y vectors need not be equally spaced (indeed they can be skewed).">

.. only:: html

  .. image:: /plot_types/arrays/images/thumb/sphx_glr_pcolormesh_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_arrays_pcolormesh.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">pcolormesh(X, Y, Z)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See contour.">

.. only:: html

  .. image:: /plot_types/arrays/images/thumb/sphx_glr_contour_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_arrays_contour.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">contour(X, Y, Z)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See contourf.">

.. only:: html

  .. image:: /plot_types/arrays/images/thumb/sphx_glr_contourf_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_arrays_contourf.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">contourf(X, Y, Z)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See barbs.">

.. only:: html

  .. image:: /plot_types/arrays/images/thumb/sphx_glr_barbs_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_arrays_barbs.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">barbs(X, Y, U, V)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See quiver.">

.. only:: html

  .. image:: /plot_types/arrays/images/thumb/sphx_glr_quiver_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_arrays_quiver.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">quiver(X, Y, U, V)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See streamplot.">

.. only:: html

  .. image:: /plot_types/arrays/images/thumb/sphx_glr_streamplot_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_arrays_streamplot.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">streamplot(X, Y, U, V)</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>


Irregularly gridded data
------------------------

Plots of data :math:`Z_{x, y}` on `unstructured grids <https://en.wikipedia.org/wiki/Unstructured_grid>`_ ,
unstructured coordinate grids :math:`(x, y)`, and 2D functions :math:`f(x, y) = z`.



.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See tricontour.">

.. only:: html

  .. image:: /plot_types/unstructured/images/thumb/sphx_glr_tricontour_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_unstructured_tricontour.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">tricontour(x, y, z)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See tricontourf.">

.. only:: html

  .. image:: /plot_types/unstructured/images/thumb/sphx_glr_tricontourf_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_unstructured_tricontourf.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">tricontourf(x, y, z)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See tripcolor.">

.. only:: html

  .. image:: /plot_types/unstructured/images/thumb/sphx_glr_tripcolor_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_unstructured_tripcolor.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">tripcolor(x, y, z)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See triplot.">

.. only:: html

  .. image:: /plot_types/unstructured/images/thumb/sphx_glr_triplot_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_unstructured_triplot.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">triplot(x, y)</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>


3D and volumetric data
----------------------

Plots of three-dimensional :math:`(x,y,z)`, surface :math:`f(x,y)=z`, and
volumetric :math:`V_{x, y, z}` data using the `mpl_toolkits.mplot3d` library.



.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See bar3d.">

.. only:: html

  .. image:: /plot_types/3D/images/thumb/sphx_glr_bar3d_simple_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_3D_bar3d_simple.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">bar3d(x, y, z, dx, dy, dz)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See fill_between.">

.. only:: html

  .. image:: /plot_types/3D/images/thumb/sphx_glr_fill_between3d_simple_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_3D_fill_between3d_simple.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">fill_between(x1, y1, z1, x2, y2, z2)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See plot.">

.. only:: html

  .. image:: /plot_types/3D/images/thumb/sphx_glr_plot3d_simple_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_3D_plot3d_simple.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">plot(xs, ys, zs)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See quiver.">

.. only:: html

  .. image:: /plot_types/3D/images/thumb/sphx_glr_quiver3d_simple_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_3D_quiver3d_simple.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">quiver(X, Y, Z, U, V, W)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See scatter.">

.. only:: html

  .. image:: /plot_types/3D/images/thumb/sphx_glr_scatter3d_simple_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_3D_scatter3d_simple.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">scatter(xs, ys, zs)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See stem.">

.. only:: html

  .. image:: /plot_types/3D/images/thumb/sphx_glr_stem3d_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_3D_stem3d.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">stem(x, y, z)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See plot_surface.">

.. only:: html

  .. image:: /plot_types/3D/images/thumb/sphx_glr_surface3d_simple_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_3D_surface3d_simple.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">plot_surface(X, Y, Z)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See plot_trisurf.">

.. only:: html

  .. image:: /plot_types/3D/images/thumb/sphx_glr_trisurf3d_simple_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_3D_trisurf3d_simple.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">plot_trisurf(x, y, z)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See voxels.">

.. only:: html

  .. image:: /plot_types/3D/images/thumb/sphx_glr_voxels_simple_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_3D_voxels_simple.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">voxels([x, y, z], filled)</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="See plot_wireframe.">

.. only:: html

  .. image:: /plot_types/3D/images/thumb/sphx_glr_wire3d_simple_thumb.png
    :alt:

  :ref:`sphx_glr_plot_types_3D_wire3d_simple.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">plot_wireframe(X, Y, Z)</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>


.. toctree::
   :hidden:
   :includehidden:


   /plot_types/basic/index.rst
   /plot_types/stats/index.rst
   /plot_types/arrays/index.rst
   /plot_types/unstructured/index.rst
   /plot_types/3D/index.rst


.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-gallery

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

      :download:`Download all examples in Python source code: plot_types_python.zip </plot_types/plot_types_python.zip>`

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

      :download:`Download all examples in Jupyter notebooks: plot_types_jupyter.zip </plot_types/plot_types_jupyter.zip>`


.. only:: html

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

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