<spanid="sphx-glr-plot-types"></span><spanid="id1"></span><h1>Plot types<aclass="headerlink" href="#plot-types" title="Permalink to this headline">#</a></h1>
<p>Overview of many common plotting commands in Matplotlib.</p>
<p>Note that we have stripped all labels, but they are present by default.
See the <aclass="reference external" href="../gallery/index.html">gallery</a> for many more examples and
the <aclass="reference external" href="../tutorials/index.html">tutorials page</a> for longer examples.</p>
<spanid="basic-plots"></span><spanid="sphx-glr-plot-types-basic"></span><h2>Basic<aclass="headerlink" href="#basic" title="Permalink to this headline">#</a></h2>
<p><spanclass="caption-text"><aclass="reference internal" href="basic/plot.html#sphx-glr-plot-types-basic-plot-py"><spanclass="std std-ref">plot(x, y)</span></a></span><aclass="headerlink" href="#id2" title="Permalink to this image">#</a></p>
<p><spanclass="caption-text"><aclass="reference internal" href="basic/scatter_plot.html#sphx-glr-plot-types-basic-scatter-plot-py"><spanclass="std std-ref">scatter(x, y)</span></a></span><aclass="headerlink" href="#id3" title="Permalink to this image">#</a></p>
<p><spanclass="caption-text"><aclass="reference internal" href="basic/stem.html#sphx-glr-plot-types-basic-stem-py"><spanclass="std std-ref">stem(x, y)</span></a></span><aclass="headerlink" href="#id5" title="Permalink to this image">#</a></p>
<p><spanclass="caption-text"><aclass="reference internal" href="basic/step.html#sphx-glr-plot-types-basic-step-py"><spanclass="std std-ref">step(x, y)</span></a></span><aclass="headerlink" href="#id6" title="Permalink to this image">#</a></p>
<p><spanclass="caption-text"><aclass="reference internal" href="basic/fill_between.html#sphx-glr-plot-types-basic-fill-between-py"><spanclass="std std-ref">fill_between(x, y1, y2)</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-clear"></div></section>
<sectionid="plots-of-arrays-and-fields">
<spanid="array-plots"></span><spanid="sphx-glr-plot-types-arrays"></span><h2>Plots of arrays and fields<aclass="headerlink" href="#plots-of-arrays-and-fields" title="Permalink to this headline">#</a></h2>
<p>Plotting for arrays of data <codeclass="docutils literal notranslate"><spanclass="pre">Z(x,</span><spanclass="pre">y)</span></code> and fields <codeclass="docutils literal notranslate"><spanclass="pre">U(x,</span><spanclass="pre">y),</span><spanclass="pre">V(x,</span><spanclass="pre">y)</span></code>.</p>
<p><spanclass="caption-text"><aclass="reference internal" href="arrays/imshow.html#sphx-glr-plot-types-arrays-imshow-py"><spanclass="std std-ref">imshow(Z)</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="~.axes.Axes.pcolormesh is more flexible than ~.axes.Axes.imshow in that the x and y vectors nee..."><figureclass="align-default" id="id9">
<imgalt="pcolormesh(X, Y, Z)" src="../_images/sphx_glr_pcolormesh_thumb.png" />
<figcaption>
<p><spanclass="caption-text"><aclass="reference internal" href="arrays/pcolormesh.html#sphx-glr-plot-types-arrays-pcolormesh-py"><spanclass="std std-ref">pcolormesh(X, Y, Z)</span></a></span><aclass="headerlink" href="#id9" title="Permalink to this image">#</a></p>
<imgalt="contour(X, Y, Z)" src="../_images/sphx_glr_contour_thumb.png" />
<figcaption>
<p><spanclass="caption-text"><aclass="reference internal" href="arrays/contour.html#sphx-glr-plot-types-arrays-contour-py"><spanclass="std std-ref">contour(X, Y, Z)</span></a></span><aclass="headerlink" href="#id10" title="Permalink to this image">#</a></p>
<imgalt="contourf(X, Y, Z)" src="../_images/sphx_glr_contourf_thumb.png" />
<figcaption>
<p><spanclass="caption-text"><aclass="reference internal" href="arrays/contourf.html#sphx-glr-plot-types-arrays-contourf-py"><spanclass="std std-ref">contourf(X, Y, Z)</span></a></span><aclass="headerlink" href="#id11" title="Permalink to this image">#</a></p>
<imgalt="barbs(X, Y, U, V)" src="../_images/sphx_glr_barbs_thumb.png" />
<figcaption>
<p><spanclass="caption-text"><aclass="reference internal" href="arrays/barbs.html#sphx-glr-plot-types-arrays-barbs-py"><spanclass="std std-ref">barbs(X, Y, U, V)</span></a></span><aclass="headerlink" href="#id12" title="Permalink to this image">#</a></p>
<imgalt="quiver(X, Y, U, V)" src="../_images/sphx_glr_quiver_thumb.png" />
<figcaption>
<p><spanclass="caption-text"><aclass="reference internal" href="arrays/quiver.html#sphx-glr-plot-types-arrays-quiver-py"><spanclass="std std-ref">quiver(X, Y, U, V)</span></a></span><aclass="headerlink" href="#id13" title="Permalink to this image">#</a></p>
<imgalt="streamplot(X, Y, U, V)" src="../_images/sphx_glr_streamplot_thumb.png" />
<figcaption>
<p><spanclass="caption-text"><aclass="reference internal" href="arrays/streamplot.html#sphx-glr-plot-types-arrays-streamplot-py"><spanclass="std std-ref">streamplot(X, Y, U, V)</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="statistics-plots">
<spanid="stats-plots"></span><spanid="sphx-glr-plot-types-stats"></span><h2>Statistics plots<aclass="headerlink" href="#statistics-plots" title="Permalink to this headline">#</a></h2>
<p><spanclass="caption-text"><aclass="reference internal" href="stats/hist_plot.html#sphx-glr-plot-types-stats-hist-plot-py"><spanclass="std std-ref">hist(x)</span></a></span><aclass="headerlink" href="#id15" title="Permalink to this image">#</a></p>
<p><spanclass="caption-text"><aclass="reference internal" href="stats/boxplot_plot.html#sphx-glr-plot-types-stats-boxplot-plot-py"><spanclass="std std-ref">boxplot(X)</span></a></span><aclass="headerlink" href="#id16" title="Permalink to this image">#</a></p>
<imgalt="errorbar(x, y, yerr, xerr)" src="../_images/sphx_glr_errorbar_plot_thumb.png" />
<figcaption>
<p><spanclass="caption-text"><aclass="reference internal" href="stats/errorbar_plot.html#sphx-glr-plot-types-stats-errorbar-plot-py"><spanclass="std std-ref">errorbar(x, y, yerr, xerr)</span></a></span><aclass="headerlink" href="#id17" title="Permalink to this image">#</a></p>
<p><spanclass="caption-text"><aclass="reference internal" href="stats/violin.html#sphx-glr-plot-types-stats-violin-py"><spanclass="std std-ref">violinplot(D)</span></a></span><aclass="headerlink" href="#id18" title="Permalink to this image">#</a></p>
<p><spanclass="caption-text"><aclass="reference internal" href="stats/eventplot.html#sphx-glr-plot-types-stats-eventplot-py"><spanclass="std std-ref">eventplot(D)</span></a></span><aclass="headerlink" href="#id19" title="Permalink to this image">#</a></p>
<p><spanclass="caption-text"><aclass="reference internal" href="stats/hist2d.html#sphx-glr-plot-types-stats-hist2d-py"><spanclass="std std-ref">hist2d(x, y)</span></a></span><aclass="headerlink" href="#id20" title="Permalink to this image">#</a></p>
<imgalt="hexbin(x, y, C)" src="../_images/sphx_glr_hexbin_thumb.png" />
<figcaption>
<p><spanclass="caption-text"><aclass="reference internal" href="stats/hexbin.html#sphx-glr-plot-types-stats-hexbin-py"><spanclass="std std-ref">hexbin(x, y, C)</span></a></span><aclass="headerlink" href="#id21" title="Permalink to this image">#</a></p>
<p><spanclass="caption-text"><aclass="reference internal" href="stats/pie.html#sphx-glr-plot-types-stats-pie-py"><spanclass="std std-ref">pie(x)</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-clear"></div></section>
<sectionid="unstructured-coordinates">
<spanid="unstructured-plots"></span><spanid="sphx-glr-plot-types-unstructured"></span><h2>Unstructured coordinates<aclass="headerlink" href="#unstructured-coordinates" title="Permalink to this headline">#</a></h2>
<p>Sometimes we collect data <codeclass="docutils literal notranslate"><spanclass="pre">z</span></code> at coordinates <codeclass="docutils literal notranslate"><spanclass="pre">(x,y)</span></code> and want to visualize
as a contour. Instead of gridding the data and then using
<aclass="reference internal" href="../api/_as_gen/matplotlib.axes.Axes.contour.html#matplotlib.axes.Axes.contour" title="matplotlib.axes.Axes.contour"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">contour</span></code></a>, we can use a triangulation algorithm and fill the
<imgalt="tricontour(x, y, z)" src="../_images/sphx_glr_tricontour_thumb.png" />
<figcaption>
<p><spanclass="caption-text"><aclass="reference internal" href="unstructured/tricontour.html#sphx-glr-plot-types-unstructured-tricontour-py"><spanclass="std std-ref">tricontour(x, y, z)</span></a></span><aclass="headerlink" href="#id23" title="Permalink to this image">#</a></p>
<imgalt="tricontourf(x, y, z)" src="../_images/sphx_glr_tricontourf_thumb.png" />
<figcaption>
<p><spanclass="caption-text"><aclass="reference internal" href="unstructured/tricontourf.html#sphx-glr-plot-types-unstructured-tricontourf-py"><spanclass="std std-ref">tricontourf(x, y, z)</span></a></span><aclass="headerlink" href="#id24" title="Permalink to this image">#</a></p>
<imgalt="tripcolor(x, y, z)" src="../_images/sphx_glr_tripcolor_thumb.png" />
<figcaption>
<p><spanclass="caption-text"><aclass="reference internal" href="unstructured/tripcolor.html#sphx-glr-plot-types-unstructured-tripcolor-py"><spanclass="std std-ref">tripcolor(x, y, z)</span></a></span><aclass="headerlink" href="#id25" title="Permalink to this image">#</a></p>
<p><spanclass="caption-text"><aclass="reference internal" href="unstructured/triplot.html#sphx-glr-plot-types-unstructured-triplot-py"><spanclass="std std-ref">triplot(x, y)</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-clear"></div><divclass="sphx-glr-footer class sphx-glr-footer-gallery docutils container">
<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.2). For the latest version see <ahref="https://matplotlib.org/stable/plot_types/index.html">https://matplotlib.org/stable/plot_types/index.html</a></div>