:orphan:

.. _tutorials:

Tutorials
=========

This page contains more in-depth guides for using Matplotlib.
It is broken up into beginner, intermediate, and advanced sections,
as well as sections covering specific topics.

For shorter examples, see our `examples page <../gallery/index.html>`_.
You can also find `external resources <../resources/index.html>`_ and
a `FAQ <../faq/index.html>`_ in our `user guide <../contents.html>`_.


.. raw:: html

    <div style='clear:both'></div>

.. _tutorials-introductory:

Introductory
-------------

These tutorials cover the basics of creating visualizations with
Matplotlib, as well as some best-practices in using the package
effectively.



.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Here you'll find a host of example plots with the code that generated them.">

.. only:: html

    .. figure:: /tutorials/introductory/images/thumb/sphx_glr_sample_plots_thumb.png

        :ref:`sphx_glr_tutorials_introductory_sample_plots.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/introductory/sample_plots

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Tips for customizing the properties and default styles of matplotlib.">

.. only:: html

    .. figure:: /tutorials/introductory/images/thumb/sphx_glr_customizing_thumb.png

        :ref:`sphx_glr_tutorials_introductory_customizing.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/introductory/customizing

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="A short tutorial on plotting images with Matplotlib.">

.. only:: html

    .. figure:: /tutorials/introductory/images/thumb/sphx_glr_images_thumb.png

        :ref:`sphx_glr_tutorials_introductory_images.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/introductory/images

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This tutorial covers some basic usage patterns and best-practices to help you get started with ...">

.. only:: html

    .. figure:: /tutorials/introductory/images/thumb/sphx_glr_usage_thumb.png

        :ref:`sphx_glr_tutorials_introductory_usage.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/introductory/usage

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="An introduction to the pyplot interface.">

.. only:: html

    .. figure:: /tutorials/introductory/images/thumb/sphx_glr_pyplot_thumb.png

        :ref:`sphx_glr_tutorials_introductory_pyplot.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/introductory/pyplot

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This tutorial aims to show the beginning, middle, and end of a single visualization using Matpl...">

.. only:: html

    .. figure:: /tutorials/introductory/images/thumb/sphx_glr_lifecycle_thumb.png

        :ref:`sphx_glr_tutorials_introductory_lifecycle.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/introductory/lifecycle
.. raw:: html

    <div style='clear:both'></div>

.. _tutorials-intermediate:

Intermediate
------------

These tutorials cover some of the more complicated classes and functions
in Matplotlib. They can be useful for particular custom and complex
visualizations.



.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Demo of custom property-cycle settings to control colors and other style properties for multi-l...">

.. only:: html

    .. figure:: /tutorials/intermediate/images/thumb/sphx_glr_color_cycle_thumb.png

        :ref:`sphx_glr_tutorials_intermediate_color_cycle.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/intermediate/color_cycle

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Generating legends flexibly in Matplotlib.">

.. only:: html

    .. figure:: /tutorials/intermediate/images/thumb/sphx_glr_legend_guide_thumb.png

        :ref:`sphx_glr_tutorials_intermediate_legend_guide.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/intermediate/legend_guide

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="How to create grid-shaped combinations of axes.">

.. only:: html

    .. figure:: /tutorials/intermediate/images/thumb/sphx_glr_gridspec_thumb.png

        :ref:`sphx_glr_tutorials_intermediate_gridspec.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/intermediate/gridspec

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Using Artist objects to render on the canvas.">

.. only:: html

    .. figure:: /tutorials/intermediate/images/thumb/sphx_glr_artists_thumb.png

        :ref:`sphx_glr_tutorials_intermediate_artists.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/intermediate/artists

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="How to use tight-layout to fit plots within your figure cleanly.">

.. only:: html

    .. figure:: /tutorials/intermediate/images/thumb/sphx_glr_tight_layout_guide_thumb.png

        :ref:`sphx_glr_tutorials_intermediate_tight_layout_guide.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/intermediate/tight_layout_guide
.. raw:: html

    <div style='clear:both'></div>

.. _tutorials-advanced:

Advanced
--------

These tutorials cover advanced topics for experienced Matplotlib
users and developers.



.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Defining paths that objects follow on a canvas.">

.. only:: html

    .. figure:: /tutorials/advanced/images/thumb/sphx_glr_patheffects_guide_thumb.png

        :ref:`sphx_glr_tutorials_advanced_patheffects_guide.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/advanced/patheffects_guide

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Defining paths in your Matplotlib visualization.">

.. only:: html

    .. figure:: /tutorials/advanced/images/thumb/sphx_glr_path_tutorial_thumb.png

        :ref:`sphx_glr_tutorials_advanced_path_tutorial.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/advanced/path_tutorial

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Like any graphics packages, Matplotlib is built on top of a transformation framework to easily ...">

.. only:: html

    .. figure:: /tutorials/advanced/images/thumb/sphx_glr_transforms_tutorial_thumb.png

        :ref:`sphx_glr_tutorials_advanced_transforms_tutorial.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/advanced/transforms_tutorial
.. raw:: html

    <div style='clear:both'></div>

.. _tutorials-colors:

Colors
------

Matplotlib has support for visualizing information with a wide array
of colors and colormaps. These tutorials cover the basics of how
these colormaps look, how you can create your own, and how you can
customize colormaps for your use case.

For even more information see the :ref:`examples page <color_examples>`.



.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Matplotlib recognizes the following formats to specify a color:">

.. only:: html

    .. figure:: /tutorials/colors/images/thumb/sphx_glr_colors_thumb.png

        :ref:`sphx_glr_tutorials_colors_colors.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/colors/colors

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This tutorial shows how to build colorbars without an attached plot.">

.. only:: html

    .. figure:: /tutorials/colors/images/thumb/sphx_glr_colorbar_only_thumb.png

        :ref:`sphx_glr_tutorials_colors_colorbar_only.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/colors/colorbar_only

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Objects that use colormaps by default linearly map the colors in the colormap from data values ...">

.. only:: html

    .. figure:: /tutorials/colors/images/thumb/sphx_glr_colormapnorms_thumb.png

        :ref:`sphx_glr_tutorials_colors_colormapnorms.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/colors/colormapnorms

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="How (and why) to choose a particular colormap.">

.. only:: html

    .. figure:: /tutorials/colors/images/thumb/sphx_glr_colormaps_thumb.png

        :ref:`sphx_glr_tutorials_colors_colormaps.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/colors/colormaps
.. raw:: html

    <div style='clear:both'></div>

.. _tutorials-text:

Text
----

matplotlib has extensive text support, including support for
mathematical expressions, truetype support for raster and
vector outputs, newline separated text with arbitrary
rotations, and unicode support. These tutorials cover
the basics of working with text in Matplotlib.



.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Annotating text with Matplotlib.">

.. only:: html

    .. figure:: /tutorials/text/images/thumb/sphx_glr_annotations_thumb.png

        :ref:`sphx_glr_tutorials_text_annotations.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/text/annotations

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="An introduction to writing mathematical expressions in Matplotlib.">

.. only:: html

    .. figure:: /tutorials/text/images/thumb/sphx_glr_mathtext_thumb.png

        :ref:`sphx_glr_tutorials_text_mathtext.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/text/mathtext

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="How to typeset text with the ``pgf`` backend in Matplotlib.">

.. only:: html

    .. figure:: /tutorials/text/images/thumb/sphx_glr_pgf_thumb.png

        :ref:`sphx_glr_tutorials_text_pgf.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/text/pgf

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Rendering text with LaTeX in Matplotlib.">

.. only:: html

    .. figure:: /tutorials/text/images/thumb/sphx_glr_usetex_thumb.png

        :ref:`sphx_glr_tutorials_text_usetex.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/text/usetex

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Introduction to plotting and working with text in Matplotlib.">

.. only:: html

    .. figure:: /tutorials/text/images/thumb/sphx_glr_text_intro_thumb.png

        :ref:`sphx_glr_tutorials_text_text_intro.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/text/text_intro

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Controlling properties of text and its layout with Matplotlib.">

.. only:: html

    .. figure:: /tutorials/text/images/thumb/sphx_glr_text_props_thumb.png

        :ref:`sphx_glr_tutorials_text_text_props.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/text/text_props
.. raw:: html

    <div style='clear:both'></div>

.. _tutorials-toolkits:

Toolkits
--------

These tutorials cover toolkits designed to extend the functionality
of Matplotlib in order to accomplish specific goals.



.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Controlling the layout of plots with the axes_grid toolkit.">

.. only:: html

    .. figure:: /tutorials/toolkits/images/thumb/sphx_glr_axes_grid_thumb.png

        :ref:`sphx_glr_tutorials_toolkits_axes_grid.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/toolkits/axes_grid

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Generating 3D plots using the mplot3d toolkit.">

.. only:: html

    .. figure:: /tutorials/toolkits/images/thumb/sphx_glr_mplot3d_thumb.png

        :ref:`sphx_glr_tutorials_toolkits_mplot3d.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/toolkits/mplot3d

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="The axisartist toolkit tutorial.">

.. only:: html

    .. figure:: /tutorials/toolkits/images/thumb/sphx_glr_axisartist_thumb.png

        :ref:`sphx_glr_tutorials_toolkits_axisartist.py`

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /tutorials/toolkits/axisartist
.. raw:: html

    <div style='clear:both'></div>



.. only :: html

 .. container:: sphx-glr-footer


  .. container:: sphx-glr-download

    :download:`Download all examples in Python source code: tutorials_python.zip <//build/matplotlib-rU0lhX/matplotlib-2.1.1/doc/tutorials/tutorials_python.zip>`



  .. container:: sphx-glr-download

    :download:`Download all examples in Jupyter notebooks: tutorials_jupyter.zip <//build/matplotlib-rU0lhX/matplotlib-2.1.1/doc/tutorials/tutorials_jupyter.zip>`


.. only:: html

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

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