<divid="unreleased-message"> You are reading an old version of the documentation (v3.3.3). For the latest version see <ahref="https://matplotlib.org/stable/tutorials/index.html">https://matplotlib.org/stable/tutorials/index.html</a></div>
<spanid="sphx-glr-tutorials"></span><spanid="id1"></span><h1>Tutorials<aclass="headerlink" href="#tutorials" title="Permalink to this headline">¶</a></h1>
<p>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.</p>
<p>For shorter examples, see our <aclass="reference external" href="../gallery/index.html">examples page</a>.
You can also find <aclass="reference external" href="../resources/index.html">external resources</a> and
a <aclass="reference external" href="../faq/index.html">FAQ</a> in our <aclass="reference external" href="../contents.html">user guide</a>.</p>
<spanid="tutorials-introductory"></span><spanid="sphx-glr-tutorials-introductory"></span><h2>Introductory<aclass="headerlink" href="#introductory" title="Permalink to this headline">¶</a></h2>
<p>These tutorials cover the basics of creating visualizations with
Matplotlib, as well as some best-practices in using the package
effectively.</p>
<divclass="sphx-glr-thumbcontainer" tooltip="This tutorial covers some basic usage patterns and best-practices to help you get started with ..."><divclass="figure align-default" id="id2">
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="introductory/usage.html#sphx-glr-tutorials-introductory-usage-py"><spanclass="std std-ref">Usage Guide</span></a></span><aclass="headerlink" href="#id2" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="An introduction to the pyplot interface."><divclass="figure align-default" id="id3">
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="introductory/pyplot.html#sphx-glr-tutorials-introductory-pyplot-py"><spanclass="std std-ref">Pyplot tutorial</span></a></span><aclass="headerlink" href="#id3" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Here you'll find a host of example plots with the code that generated them."><divclass="figure align-default" id="id4">
<imgalt="Sample plots in Matplotlib" src="../_images/sphx_glr_sample_plots_thumb.png" />
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="introductory/sample_plots.html#sphx-glr-tutorials-introductory-sample-plots-py"><spanclass="std std-ref">Sample plots in Matplotlib</span></a></span><aclass="headerlink" href="#id4" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="A short tutorial on plotting images with Matplotlib."><divclass="figure align-default" id="id5">
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="introductory/images.html#sphx-glr-tutorials-introductory-images-py"><spanclass="std std-ref">Image tutorial</span></a></span><aclass="headerlink" href="#id5" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="This tutorial aims to show the beginning, middle, and end of a single visualization using Matpl..."><divclass="figure align-default" id="id6">
<imgalt="The Lifecycle of a Plot" src="../_images/sphx_glr_lifecycle_thumb.png" />
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="introductory/lifecycle.html#sphx-glr-tutorials-introductory-lifecycle-py"><spanclass="std std-ref">The Lifecycle of a Plot</span></a></span><aclass="headerlink" href="#id6" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Tips for customizing the properties and default styles of Matplotlib."><divclass="figure align-default" id="id7">
<imgalt="Customizing Matplotlib with style sheets and rcParams" src="../_images/sphx_glr_customizing_thumb.png" />
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="introductory/customizing.html#sphx-glr-tutorials-introductory-customizing-py"><spanclass="std std-ref">Customizing Matplotlib with style sheets and rcParams</span></a></span><aclass="headerlink" href="#id7" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-clear"></div></div>
<divclass="section" id="intermediate">
<spanid="tutorials-intermediate"></span><spanid="sphx-glr-tutorials-intermediate"></span><h2>Intermediate<aclass="headerlink" href="#intermediate" title="Permalink to this headline">¶</a></h2>
<p>These tutorials cover some of the more complicated classes and functions
in Matplotlib. They can be useful for particular custom and complex
visualizations.</p>
<divclass="sphx-glr-thumbcontainer" tooltip="Using Artist objects to render on the canvas."><divclass="figure align-default" id="id8">
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="intermediate/artists.html#sphx-glr-tutorials-intermediate-artists-py"><spanclass="std std-ref">Artist tutorial</span></a></span><aclass="headerlink" href="#id8" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Generating legends flexibly in Matplotlib."><divclass="figure align-default" id="id9">
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="intermediate/legend_guide.html#sphx-glr-tutorials-intermediate-legend-guide-py"><spanclass="std std-ref">Legend guide</span></a></span><aclass="headerlink" href="#id9" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Demo of custom property-cycle settings to control colors and other style properties for multi-l..."><divclass="figure align-default" id="id10">
<imgalt="Styling with cycler" src="../_images/sphx_glr_color_cycle_thumb.png" />
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="intermediate/color_cycle.html#sphx-glr-tutorials-intermediate-color-cycle-py"><spanclass="std std-ref">Styling with cycler</span></a></span><aclass="headerlink" href="#id10" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="How to create grid-shaped combinations of axes."><divclass="figure align-default" id="id11">
<imgalt="Customizing Figure Layouts Using GridSpec and Other Functions" src="../_images/sphx_glr_gridspec_thumb.png" />
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="intermediate/gridspec.html#sphx-glr-tutorials-intermediate-gridspec-py"><spanclass="std std-ref">Customizing Figure Layouts Using GridSpec and Other Functions</span></a></span><aclass="headerlink" href="#id11" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="How to use constrained-layout to fit plots within your figure cleanly."><divclass="figure align-default" id="id12">
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="intermediate/constrainedlayout_guide.html#sphx-glr-tutorials-intermediate-constrainedlayout-guide-py"><spanclass="std std-ref">Constrained Layout Guide</span></a></span><aclass="headerlink" href="#id12" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="How to use tight-layout to fit plots within your figure cleanly."><divclass="figure align-default" id="id13">
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="intermediate/tight_layout_guide.html#sphx-glr-tutorials-intermediate-tight-layout-guide-py"><spanclass="std std-ref">Tight Layout guide</span></a></span><aclass="headerlink" href="#id13" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="imshow allows you to render an image (either a 2D array which will be color-mapped (based on *n..."><divclass="figure align-default" id="id14">
<imgalt="*origin* and *extent* in `~.Axes.imshow`" src="../_images/sphx_glr_imshow_extent_thumb.png" />
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="intermediate/imshow_extent.html#sphx-glr-tutorials-intermediate-imshow-extent-py"><spanclass="std std-ref">origin and extent in imshow</span></a></span><aclass="headerlink" href="#id14" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-clear"></div></div>
<divclass="section" id="advanced">
<spanid="tutorials-advanced"></span><spanid="sphx-glr-tutorials-advanced"></span><h2>Advanced<aclass="headerlink" href="#advanced" title="Permalink to this headline">¶</a></h2>
<p>These tutorials cover advanced topics for experienced Matplotlib
users and developers.</p>
<divclass="sphx-glr-thumbcontainer" tooltip="'Blitting' is a `standard technique <https://en.wikipedia.org/wiki/Bit_blit>`__ in raster graph..."><divclass="figure align-default" id="id15">
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="advanced/blitting.html#sphx-glr-tutorials-advanced-blitting-py"><spanclass="std std-ref">Blitting tutorial</span></a></span><aclass="headerlink" href="#id15" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Defining paths in your Matplotlib visualization."><divclass="figure align-default" id="id16">
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="advanced/path_tutorial.html#sphx-glr-tutorials-advanced-path-tutorial-py"><spanclass="std std-ref">Path Tutorial</span></a></span><aclass="headerlink" href="#id16" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Defining paths that objects follow on a canvas."><divclass="figure align-default" id="id17">
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="advanced/patheffects_guide.html#sphx-glr-tutorials-advanced-patheffects-guide-py"><spanclass="std std-ref">Path effects guide</span></a></span><aclass="headerlink" href="#id17" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Like any graphics packages, Matplotlib is built on top of a transformation framework to easily ..."><divclass="figure align-default" id="id18">
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="advanced/transforms_tutorial.html#sphx-glr-tutorials-advanced-transforms-tutorial-py"><spanclass="std std-ref">Transformations Tutorial</span></a></span><aclass="headerlink" href="#id18" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-clear"></div></div>
<divclass="section" id="colors">
<spanid="tutorials-colors"></span><spanid="sphx-glr-tutorials-colors"></span><h2>Colors<aclass="headerlink" href="#colors" title="Permalink to this headline">¶</a></h2>
<p>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.</p>
<p>For even more information see the <aclass="reference internal" href="../gallery/index.html#color-examples"><spanclass="std std-ref">examples page</span></a>.</p>
<divclass="sphx-glr-thumbcontainer" tooltip="Matplotlib recognizes the following formats to specify a color:"><divclass="figure align-default" id="id19">
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="colors/colors.html#sphx-glr-tutorials-colors-colors-py"><spanclass="std std-ref">Specifying Colors</span></a></span><aclass="headerlink" href="#id19" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="This tutorial shows how to build and customize standalone colorbars, i.e. without an attached p..."><divclass="figure align-default" id="id20">
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="colors/colorbar_only.html#sphx-glr-tutorials-colors-colorbar-only-py"><spanclass="std std-ref">Customized Colorbars Tutorial</span></a></span><aclass="headerlink" href="#id20" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Matplotlib has a number of built-in colormaps accessible via .matplotlib.cm.get_cmap. There ar..."><divclass="figure align-default" id="id21">
<imgalt="Creating Colormaps in Matplotlib" src="../_images/sphx_glr_colormap-manipulation_thumb.png" />
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="colors/colormap-manipulation.html#sphx-glr-tutorials-colors-colormap-manipulation-py"><spanclass="std std-ref">Creating Colormaps in Matplotlib</span></a></span><aclass="headerlink" href="#id21" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Objects that use colormaps by default linearly map the colors in the colormap from data values ..."><divclass="figure align-default" id="id22">
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="colors/colormapnorms.html#sphx-glr-tutorials-colors-colormapnorms-py"><spanclass="std std-ref">Colormap Normalization</span></a></span><aclass="headerlink" href="#id22" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Matplotlib has a number of built-in colormaps accessible via .matplotlib.cm.get_cmap. There ar..."><divclass="figure align-default" id="id23">
<imgalt="Choosing Colormaps in Matplotlib" src="../_images/sphx_glr_colormaps_thumb.png" />
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="colors/colormaps.html#sphx-glr-tutorials-colors-colormaps-py"><spanclass="std std-ref">Choosing Colormaps in Matplotlib</span></a></span><aclass="headerlink" href="#id23" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-clear"></div></div>
<divclass="section" id="provisional">
<spanid="tutorials-provisional"></span><spanid="sphx-glr-tutorials-provisional"></span><h2>Provisional<aclass="headerlink" href="#provisional" title="Permalink to this headline">¶</a></h2>
<p>These tutorials cover proposed APIs of any complexity. These are here
to document features that we have released, but want to get user
feedback on before committing to them. Please have a look, try them
out and give us feedback on <aclass="reference external" href="https://gitter.im/matplotlib/matplotlib">gitter</a>, <aclass="reference external" href="https://discourse.matplotlib.org">discourse</a>, or the <aclass="reference external" href="https://mail.python.org/mailman/listinfo/matplotlib-users">the mailing list</a>! But,
be aware that we may change the APIs without warning in subsequent
versions.</p>
<divclass="sphx-glr-thumbcontainer" tooltip=" This tutorial documents experimental / provisional API. We are releasing this in v3.3 to ..."><divclass="figure align-default" id="id24">
<imgalt="Complex and semantic figure composition" src="../_images/sphx_glr_mosaic_thumb.png" />
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="provisional/mosaic.html#sphx-glr-tutorials-provisional-mosaic-py"><spanclass="std std-ref">Complex and semantic figure composition</span></a></span><aclass="headerlink" href="#id24" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-clear"></div></div>
<divclass="section" id="text">
<spanid="tutorials-text"></span><spanid="sphx-glr-tutorials-text"></span><h2>Text<aclass="headerlink" href="#text" title="Permalink to this headline">¶</a></h2>
<p>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.</p>
<divclass="sphx-glr-thumbcontainer" tooltip="Introduction to plotting and working with text in Matplotlib."><divclass="figure align-default" id="id25">
<imgalt="Text in Matplotlib Plots" src="../_images/sphx_glr_text_intro_thumb.png" />
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="text/text_intro.html#sphx-glr-tutorials-text-text-intro-py"><spanclass="std std-ref">Text in Matplotlib Plots</span></a></span><aclass="headerlink" href="#id25" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Controlling properties of text and its layout with Matplotlib."><divclass="figure align-default" id="id26">
<imgalt="Text properties and layout" src="../_images/sphx_glr_text_props_thumb.png" />
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="text/text_props.html#sphx-glr-tutorials-text-text-props-py"><spanclass="std std-ref">Text properties and layout</span></a></span><aclass="headerlink" href="#id26" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Annotating text with Matplotlib."><divclass="figure align-default" id="id27">
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="text/annotations.html#sphx-glr-tutorials-text-annotations-py"><spanclass="std std-ref">Annotations</span></a></span><aclass="headerlink" href="#id27" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="An introduction to writing mathematical expressions in Matplotlib."><divclass="figure align-default" id="id28">
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="text/mathtext.html#sphx-glr-tutorials-text-mathtext-py"><spanclass="std std-ref">Writing mathematical expressions</span></a></span><aclass="headerlink" href="#id28" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="How to typeset text with the pgf backend in Matplotlib."><divclass="figure align-default" id="id29">
<imgalt="Typesetting With XeLaTeX/LuaLaTeX" src="../_images/sphx_glr_pgf_thumb.png" />
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="text/pgf.html#sphx-glr-tutorials-text-pgf-py"><spanclass="std std-ref">Typesetting With XeLaTeX/LuaLaTeX</span></a></span><aclass="headerlink" href="#id29" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Rendering text with LaTeX in Matplotlib."><divclass="figure align-default" id="id30">
<imgalt="Text rendering With LaTeX" src="../_images/sphx_glr_usetex_thumb.png" />
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="text/usetex.html#sphx-glr-tutorials-text-usetex-py"><spanclass="std std-ref">Text rendering With LaTeX</span></a></span><aclass="headerlink" href="#id30" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-clear"></div></div>
<divclass="section" id="toolkits">
<spanid="tutorials-toolkits"></span><spanid="sphx-glr-tutorials-toolkits"></span><h2>Toolkits<aclass="headerlink" href="#toolkits" title="Permalink to this headline">¶</a></h2>
<p>These tutorials cover toolkits designed to extend the functionality
of Matplotlib in order to accomplish specific goals.</p>
<divclass="sphx-glr-thumbcontainer" tooltip="Controlling the layout of plots with the mpl_toolkits.axes_grid1 toolkit."><divclass="figure align-default" id="id31">
<imgalt="Overview of axes_grid1 toolkit" src="../_images/sphx_glr_axes_grid_thumb.png" />
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="toolkits/axes_grid.html#sphx-glr-tutorials-toolkits-axes-grid-py"><spanclass="std std-ref">Overview of axes_grid1 toolkit</span></a></span><aclass="headerlink" href="#id31" title="Permalink to this image">¶</a></p>
<imgalt="Overview of axisartist toolkit" src="../_images/sphx_glr_axisartist_thumb.png" />
<pclass="caption"><spanclass="caption-text"><aclass="reference internal" href="toolkits/axisartist.html#sphx-glr-tutorials-toolkits-axisartist-py"><spanclass="std std-ref">Overview of axisartist toolkit</span></a></span><aclass="headerlink" href="#id32" title="Permalink to this image">¶</a></p>
</div>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Generating 3D plots using the mplot3d toolkit."><divclass="figure align-default" id="id33">