<pclass="last">Click <aclass="reference internal" href="#sphx-glr-download-tutorials-toolkits-mplot3d-py"><spanclass="std std-ref">here</span></a> to download the full example code</p>
<spanid="sphx-glr-tutorials-toolkits-mplot3d-py"></span><h1>The mplot3d Toolkit<aclass="headerlink" href="#the-mplot3d-toolkit" title="Permalink to this headline">¶</a></h1>
<p>Generating 3D plots using the mplot3d toolkit.</p>
<spanid="toolkit-mplot3d-tutorial"></span><h2>Getting started<aclass="headerlink" href="#getting-started" title="Permalink to this headline">¶</a></h2>
<p>An Axes3D object is created just like any other axes using
the projection=‘3d’ keyword.
Create a new <aclass="reference internal" href="../../api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure" title="matplotlib.figure.Figure"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">matplotlib.figure.Figure</span></code></a> and
add a new axes to it of type <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Axes3D</span></code>:</p>
to <codeclass="docutils literal notranslate"><spanclass="pre">ax</span><spanclass="pre">=</span><spanclass="pre">Axes3D(fig)</span></code>.</p>
</div>
<p>See the <aclass="reference internal" href="../../mpl_toolkits/mplot3d/faq.html#toolkit-mplot3d-faq"><spanclass="std std-ref">mplot3d FAQ</span></a> for more information about the mplot3d
toolkit.</p>
<divclass="section" id="line-plots">
<spanid="plot3d"></span><h3>Line plots<aclass="headerlink" href="#line-plots" title="Permalink to this headline">¶</a></h3>
<dlclass="method">
<dtid="mpl_toolkits.mplot3d.Axes3D.plot">
<codeclass="descclassname">Axes3D.</code><codeclass="descname">plot</code><spanclass="sig-paren">(</span><em>xs</em>, <em>ys</em>, <em>*args</em>, <em>**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../../_modules/mpl_toolkits/mplot3d/axes3d.html#Axes3D.plot"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#mpl_toolkits.mplot3d.Axes3D.plot" title="Permalink to this definition">¶</a></dt>
<dd><pclass="first">Downsampling stride in each direction. These arguments are
mutually exclusive with <em>rcount</em> and <em>ccount</em>. If only one of
<em>rstride</em> or <em>cstride</em> is set, the other defaults to 1. Setting a
stride to zero causes the data to be not sampled in the
corresponding direction, producing a 3D line plot rather than a
wireframe plot.</p>
<pclass="last">‘classic’ mode uses a default of <codeclass="docutils literal notranslate"><spanclass="pre">rstride</span><spanclass="pre">=</span><spanclass="pre">cstride</span><spanclass="pre">=</span><spanclass="pre">1</span></code> instead
of the new default of <codeclass="docutils literal notranslate"><spanclass="pre">rcount</span><spanclass="pre">=</span><spanclass="pre">ccount</span><spanclass="pre">=</span><spanclass="pre">50</span></code>.</p>
</dd>
<dt><strong>**kwargs :</strong></dt>
<dd><pclass="first last">Other arguments are forwarded to <aclass="reference internal" href="../../api/_as_gen/mpl_toolkits.mplot3d.art3d.Line3DCollection.html#mpl_toolkits.mplot3d.art3d.Line3DCollection" title="mpl_toolkits.mplot3d.art3d.Line3DCollection"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Line3DCollection</span></code></a>.</p>
<dd><pclass="first">Downsampling stride in each direction. These arguments are
mutually exclusive with <em>rcount</em> and <em>ccount</em>. If only one of
<em>rstride</em> or <em>cstride</em> is set, the other defaults to 10.</p>
<pclass="last">‘classic’ mode uses a default of <codeclass="docutils literal notranslate"><spanclass="pre">rstride</span><spanclass="pre">=</span><spanclass="pre">cstride</span><spanclass="pre">=</span><spanclass="pre">10</span></code> instead
of the new default of <codeclass="docutils literal notranslate"><spanclass="pre">rcount</span><spanclass="pre">=</span><spanclass="pre">ccount</span><spanclass="pre">=</span><spanclass="pre">50</span></code>.</p>
<spanid="trisurface"></span><h3>Tri-Surface plots<aclass="headerlink" href="#tri-surface-plots" title="Permalink to this headline">¶</a></h3>
<dlclass="method">
<dtid="mpl_toolkits.mplot3d.Axes3D.plot_trisurf">
<codeclass="descclassname">Axes3D.</code><codeclass="descname">plot_trisurf</code><spanclass="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../../_modules/mpl_toolkits/mplot3d/axes3d.html#Axes3D.plot_trisurf"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#mpl_toolkits.mplot3d.Axes3D.plot_trisurf" title="Permalink to this definition">¶</a></dt>
<p>in which case a Triangulation object will be created. See
<aclass="reference internal" href="../../api/tri_api.html#matplotlib.tri.Triangulation" title="matplotlib.tri.Triangulation"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Triangulation</span></code></a> for a explanation of
<codeclass="descclassname">Axes3D.</code><codeclass="descname">add_collection3d</code><spanclass="sig-paren">(</span><em>col</em>, <em>zs=0</em>, <em>zdir='z'</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../../_modules/mpl_toolkits/mplot3d/axes3d.html#Axes3D.add_collection3d"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#mpl_toolkits.mplot3d.Axes3D.add_collection3d" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a 3D collection object to the plot.</p>
<p>2D collection types are converted to a 3D version by
modifying the object and adding z coordinate information.</p>
<spanid="quiver3d"></span><h3>Quiver<aclass="headerlink" href="#quiver" title="Permalink to this headline">¶</a></h3>
<dlclass="method">
<dtid="mpl_toolkits.mplot3d.Axes3D.quiver">
<codeclass="descclassname">Axes3D.</code><codeclass="descname">quiver</code><spanclass="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../../_modules/mpl_toolkits/mplot3d/axes3d.html#Axes3D.quiver"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#mpl_toolkits.mplot3d.Axes3D.quiver" title="Permalink to this definition">¶</a></dt>