<divid="unreleased-message"> You are reading an old version of the documentation (v2.2.4). For the latest version see <ahref="https://matplotlib.org/stable/gallery/mplot3d/bars3d.html">https://matplotlib.org/stable/gallery/mplot3d/bars3d.html</a></div>
<pclass="last">Click <aclass="reference internal" href="#sphx-glr-download-gallery-mplot3d-bars3d-py"><spanclass="std std-ref">here</span></a> to download the full example code</p>
<spanid="sphx-glr-gallery-mplot3d-bars3d-py"></span><h1>Create 2D bar graphs in different planes<aclass="headerlink" href="#create-2d-bar-graphs-in-different-planes" title="Permalink to this headline">¶</a></h1>
<p>Demonstrates making a 3D plot which has 2D bar graphs projected onto
<spanclass="c1"># Fixing random state for reproducibility</span>
<ahref="https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.seed.html#numpy.random.seed" title="View documentation for numpy.random.seed"><spanclass="n">np</span><spanclass="o">.</span><spanclass="n">random</span><spanclass="o">.</span><spanclass="n">seed</span></a><spanclass="p">(</span><spanclass="mi">19680801</span><spanclass="p">)</span>
<spanclass="n">fig</span><spanclass="o">=</span><ahref="../../api/_as_gen/matplotlib.pyplot.figure.html#matplotlib.pyplot.figure" title="View documentation for matplotlib.pyplot.figure"><spanclass="n">plt</span><spanclass="o">.</span><spanclass="n">figure</span></a><spanclass="p">()</span>
<spanclass="c1"># Generate the random data for the y=k 'layer'.</span>
<spanclass="n">xs</span><spanclass="o">=</span><ahref="https://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html#numpy.arange" title="View documentation for numpy.arange"><spanclass="n">np</span><spanclass="o">.</span><spanclass="n">arange</span></a><spanclass="p">(</span><spanclass="mi">20</span><spanclass="p">)</span>
<spanclass="n">ys</span><spanclass="o">=</span><ahref="https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.rand.html#numpy.random.rand" title="View documentation for numpy.random.rand"><spanclass="n">np</span><spanclass="o">.</span><spanclass="n">random</span><spanclass="o">.</span><spanclass="n">rand</span></a><spanclass="p">(</span><spanclass="mi">20</span><spanclass="p">)</span>
<spanclass="c1"># You can provide either a single color or an array with the same length as</span>
<spanclass="c1"># xs and ys. To demonstrate this, we color the first bar of each set cyan.</span>
<ahref="../../api/_as_gen/matplotlib.pyplot.show.html#matplotlib.pyplot.show" title="View documentation for matplotlib.pyplot.show"><spanclass="n">plt</span><spanclass="o">.</span><spanclass="n">show</span></a><spanclass="p">()</span>
</pre></div>
</div>
<divclass="sphx-glr-footer class sphx-glr-footer-example docutils container" id="sphx-glr-download-gallery-mplot3d-bars3d-py">