<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 ..."><figureclass="align-default" id="id2">
<p><spanclass="caption-text"><aclass="reference internal" href="introductory/usage.html#sphx-glr-tutorials-introductory-usage-py"><spanclass="std std-ref">Basic Usage</span></a></span><aclass="headerlink" href="#id2" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="An introduction to the pyplot interface."><figureclass="align-default" id="id3">
<p><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>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="A short tutorial on plotting images with Matplotlib."><figureclass="align-default" id="id4">
<p><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="#id4" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
</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..."><figureclass="align-default" id="id5">
<imgalt="The Lifecycle of a Plot" src="../_images/sphx_glr_lifecycle_thumb.png" />
<figcaption>
<p><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="#id5" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Tips for customizing the properties and default styles of Matplotlib."><figureclass="align-default" id="id6">
<imgalt="Customizing Matplotlib with style sheets and rcParams" src="../_images/sphx_glr_customizing_thumb.png" />
<figcaption>
<p><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="#id6" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-clear"></div></section>
<sectionid="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."><figureclass="align-default" id="id7">
<p><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="#id7" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Generating legends flexibly in Matplotlib."><figureclass="align-default" id="id8">
<p><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="#id8" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
</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..."><figureclass="align-default" id="id9">
<imgalt="Styling with cycler" src="../_images/sphx_glr_color_cycle_thumb.png" />
<figcaption>
<p><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="#id9" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="How to use constrained-layout to fit plots within your figure cleanly."><figureclass="align-default" id="id10">
<p><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="#id11" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Often more than one Axes is wanted on a figure at a time, usually organized into a regular grid..."><figureclass="align-default" id="id12">
<imgalt="Arranging multiple Axes in a Figure" src="../_images/sphx_glr_arranging_axes_thumb.png" />
<figcaption>
<p><spanclass="caption-text"><aclass="reference internal" href="intermediate/arranging_axes.html#sphx-glr-tutorials-intermediate-arranging-axes-py"><spanclass="std std-ref">Arranging multiple Axes in a Figure</span></a></span><aclass="headerlink" href="#id12" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="The limits on an axis can be set manually (e.g. ax.set_xlim(xmin, xmax)) or Matplotlib can set ..."><figureclass="align-default" id="id13">
<p><spanclass="caption-text"><aclass="reference internal" href="intermediate/autoscale.html#sphx-glr-tutorials-intermediate-autoscale-py"><spanclass="std std-ref">Autoscaling</span></a></span><aclass="headerlink" href="#id13" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
</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..."><figureclass="align-default" id="id14">
<imgalt="*origin* and *extent* in `~.Axes.imshow`" src="../_images/sphx_glr_imshow_extent_thumb.png" />
<figcaption>
<p><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>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-clear"></div></section>
<sectionid="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..."><figureclass="align-default" id="id15">
<imgalt="Faster rendering by using blitting" src="../_images/sphx_glr_blitting_thumb.png" />
<figcaption>
<p><spanclass="caption-text"><aclass="reference internal" href="advanced/blitting.html#sphx-glr-tutorials-advanced-blitting-py"><spanclass="std std-ref">Faster rendering by using blitting</span></a></span><aclass="headerlink" href="#id15" title="Permalink to this image">¶</a></p>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Defining paths in your Matplotlib visualization."><figureclass="align-default" id="id16">
<p><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>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Defining paths that objects follow on a canvas."><figureclass="align-default" id="id17">
<p><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>
</figcaption>
</figure>
</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 ..."><figureclass="align-default" id="id18">
<p><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>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-clear"></div></section>
<sectionid="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."><figureclass="align-default" id="id19">
<p><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>
</figcaption>
</figure>
</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..."><figureclass="align-default" id="id20">
<p><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>
</figcaption>
</figure>
</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..."><figureclass="align-default" id="id21">
<imgalt="Creating Colormaps in Matplotlib" src="../_images/sphx_glr_colormap-manipulation_thumb.png" />
<figcaption>
<p><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>
</figcaption>
</figure>
</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 ..."><figureclass="align-default" id="id22">
<p><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>
</figcaption>
</figure>
</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..."><figureclass="align-default" id="id23">
<imgalt="Choosing Colormaps in Matplotlib" src="../_images/sphx_glr_colormaps_thumb.png" />
<figcaption>
<p><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>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-clear"></div></section>
<sectionid="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 ..."><figureclass="align-default" id="id24">
<imgalt="Complex and semantic figure composition" src="../_images/sphx_glr_mosaic_thumb.png" />
<figcaption>
<p><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>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-clear"></div></section>
<sectionid="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."><figureclass="align-default" id="id25">
<imgalt="Text in Matplotlib Plots" src="../_images/sphx_glr_text_intro_thumb.png" />
<figcaption>
<p><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>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Controlling properties of text and its layout with Matplotlib."><figureclass="align-default" id="id26">
<imgalt="Text properties and layout" src="../_images/sphx_glr_text_props_thumb.png" />
<figcaption>
<p><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>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Annotating text with Matplotlib."><figureclass="align-default" id="id27">
<p><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>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="You can use a subset of TeX markup in any Matplotlib text string by placing it inside a pair of..."><figureclass="align-default" id="id28">
<p><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>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="How to typeset text with the pgf backend in Matplotlib."><figureclass="align-default" id="id29">
<imgalt="Typesetting with XeLaTeX/LuaLaTeX" src="../_images/sphx_glr_pgf_thumb.png" />
<figcaption>
<p><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>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Matplotlib can use LaTeX to render text. This is activated by setting text.usetex : True in yo..."><figureclass="align-default" id="id30">
<imgalt="Text rendering with LaTeX" src="../_images/sphx_glr_usetex_thumb.png" />
<figcaption>
<p><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>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-clear"></div></section>
<sectionid="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=".axes_grid1 provides the following features:"><figureclass="align-default" id="id31">
<imgalt="Overview of :mod:`mpl_toolkits.axes_grid1`" src="../_images/sphx_glr_axes_grid_thumb.png" />
<figcaption>
<p><spanclass="caption-text"><aclass="reference internal" href="toolkits/axes_grid.html#sphx-glr-tutorials-toolkits-axes-grid-py"><spanclass="std std-ref">Overview of mpl_toolkits.axes_grid1</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" />
<figcaption>
<p><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>
</figcaption>
</figure>
</div><divclass="toctree-wrapper compound">
</div>
<divclass="sphx-glr-thumbcontainer" tooltip="Generating 3D plots using the mplot3d toolkit."><figureclass="align-default" id="id33">
<pclass="sphx-glr-signature">Keywords: matplotlib code example, codex, python plot, pyplot
<aclass="reference external" href="https://sphinx-gallery.readthedocs.io">Gallery generated by Sphinx-Gallery</a></p>
</section>
</section>
</div>
</main>
</div>
</div>
<!-- Scripts loaded after <body> so the DOM is not blocked -->
<divid="unreleased-message"> You are reading an old version of the documentation (v3.5.1). For the latest version see <ahref="https://matplotlib.org/stable/tutorials/index.html">https://matplotlib.org/stable/tutorials/index.html</a></div>