<divid="unreleased-message"> You are reading an old version of the documentation (v3.1.0). For the latest version see <ahref="https://matplotlib.org/stable/gallery/statistics/boxplot.html">https://matplotlib.org/stable/gallery/statistics/boxplot.html</a></div>
<pclass="last">Click <aclass="reference internal" href="#sphx-glr-download-gallery-statistics-boxplot-py"><spanclass="std std-ref">here</span></a> to download the full example code</p>
<spanid="sphx-glr-gallery-statistics-boxplot-py"></span><h1>Artist customization in box plots<aclass="headerlink" href="#artist-customization-in-box-plots" title="Permalink to this headline">¶</a></h1>
<p>This example demonstrates how to use the various kwargs
to fully customize box plots. The first figure demonstrates
how to remove and add individual components (note that the
mean is the only value not shown by default). The second
figure demonstrates how the styles of the artists can
be customized. It also demonstrates how to set the limit
of the whiskers to specific percentiles (lower right axes)</p>
<p>A good general reference on boxplots and their history can be found
<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">data</span><spanclass="o">=</span><ahref="https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.lognormal.html#numpy.random.lognormal" title="View documentation for numpy.random.lognormal"><spanclass="n">np</span><spanclass="o">.</span><spanclass="n">random</span><spanclass="o">.</span><spanclass="n">lognormal</span></a><spanclass="p">(</span><spanclass="n">size</span><spanclass="o">=</span><spanclass="p">(</span><spanclass="mi">37</span><spanclass="p">,</span><spanclass="mi">4</span><spanclass="p">),</span><spanclass="n">mean</span><spanclass="o">=</span><spanclass="mf">1.5</span><spanclass="p">,</span><spanclass="n">sigma</span><spanclass="o">=</span><spanclass="mf">1.75</span><spanclass="p">)</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>
<spanclass="n">fig</span><spanclass="p">,</span><spanclass="n">axes</span><spanclass="o">=</span><ahref="../../api/_as_gen/matplotlib.pyplot.subplots.html#matplotlib.pyplot.subplots" title="View documentation for matplotlib.pyplot.subplots"><spanclass="n">plt</span><spanclass="o">.</span><spanclass="n">subplots</span></a><spanclass="p">(</span><spanclass="n">nrows</span><spanclass="o">=</span><spanclass="mi">2</span><spanclass="p">,</span><spanclass="n">ncols</span><spanclass="o">=</span><spanclass="mi">3</span><spanclass="p">,</span><spanclass="n">figsize</span><spanclass="o">=</span><spanclass="p">(</span><spanclass="mi">6</span><spanclass="p">,</span><spanclass="mi">6</span><spanclass="p">),</span><spanclass="n">sharey</span><spanclass="o">=</span><spanclass="kc">True</span><spanclass="p">)</span>
<spanclass="n">fig</span><spanclass="o">.</span><spanclass="n">suptitle</span><spanclass="p">(</span><spanclass="s2">"I never said they'd be pretty"</span><spanclass="p">)</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>