<divid="unreleased-message"> You are reading an old version of the documentation (v3.4.2). For the latest version see <ahref="https://matplotlib.org/stable/api/container_api.html">https://matplotlib.org/stable/api/container_api.html</a></div>
<spanid="matplotlib-container"></span><h1><codeclass="docutils literal notranslate"><spanclass="pre">matplotlib.container</span></code><aclass="headerlink" href="#module-matplotlib.container" title="Permalink to this headline">¶</a></h1>
<dlclass="py class">
<dtid="matplotlib.container.BarContainer">
<emclass="property">class </em><codeclass="descclassname">matplotlib.container.</code><codeclass="descname">BarContainer</code><spanclass="sig-paren">(</span><em><spanclass="o">*</span><spanclass="n">args</span></em>, <em><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/container.html#BarContainer"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.container.BarContainer" title="Permalink to this definition">¶</a></dt>
<p>Container for the artists of bar plots (e.g. created by <aclass="reference internal" href="_as_gen/matplotlib.axes.Axes.bar.html#matplotlib.axes.Axes.bar" title="matplotlib.axes.Axes.bar"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Axes.bar</span></code></a>).</p>
<p>The container can be treated as a tuple of the <em>patches</em> themselves.
Additionally, you can access these and further parameters by the
<trclass="field-odd field"><thclass="field-name">Attributes:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>patches</strong><spanclass="classifier">list of <aclass="reference internal" href="_as_gen/matplotlib.patches.Rectangle.html#matplotlib.patches.Rectangle" title="matplotlib.patches.Rectangle"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Rectangle</span></code></a></span></dt><dd><p>The artists of the bars.</p>
</dd>
<dt><strong>errorbar</strong><spanclass="classifier">None or <aclass="reference internal" href="#matplotlib.container.ErrorbarContainer" title="matplotlib.container.ErrorbarContainer"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">ErrorbarContainer</span></code></a></span></dt><dd><p>A container for the error bar artists if error bars are present.
<em>None</em> otherwise.</p>
</dd>
<dt><strong>datavalues</strong><spanclass="classifier">None or array-like</span></dt><dd><p>The underlying data values corresponding to the bars.</p>
</dd>
<dt><strong>orientation</strong><spanclass="classifier">{'vertical', 'horizontal'}, default: None</span></dt><dd><p>If 'vertical', the bars are assumed to be vertical.
If 'horizontal', the bars are assumed to be horizontal.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.container.Container">
<emclass="property">class </em><codeclass="descclassname">matplotlib.container.</code><codeclass="descname">Container</code><spanclass="sig-paren">(</span><em><spanclass="o">*</span><spanclass="n">args</span></em>, <em><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/container.html#Container"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.container.Container" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">add_callback</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">func</span></em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.container.Container.add_callback" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a callback function that will be called whenever one of the
<p>where <em>artist</em> is the calling <aclass="reference internal" href="artist_api.html#matplotlib.artist.Artist" title="matplotlib.artist.Artist"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Artist</span></code></a>. Return values may exist
but are ignored.</p>
</dd>
</dl>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><dlclass="first last docutils">
<dt>int</dt><dd><p>The observer id associated with the callback. This id can be
used for removing the callback with <aclass="reference internal" href="#matplotlib.container.Container.remove_callback" title="matplotlib.container.Container.remove_callback"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">remove_callback</span></code></a> later.</p>
<codeclass="descname">get_children</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/container.html#Container.get_children"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.container.Container.get_children" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="py method">
<dtid="matplotlib.container.Container.get_label">
<codeclass="descname">get_label</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.container.Container.get_label" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the label used for this artist in the legend.</p>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.container.Container.pchanged">
<codeclass="descname">pchanged</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.container.Container.pchanged" title="Permalink to this definition">¶</a></dt>
<dd><p>Call all of the registered callbacks.</p>
<p>This function is triggered internally when a property is changed.</p>
<codeclass="descname">remove</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/container.html#Container.remove"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.container.Container.remove" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">remove_callback</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">oid</span></em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.container.Container.remove_callback" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove a callback based on its observer id.</p>
<codeclass="descname">set_label</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">s</span></em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.container.Container.set_label" title="Permalink to this definition">¶</a></dt>
<dd><p>Set a label that will be displayed in the legend.</p>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>s</strong><spanclass="classifier">object</span></dt><dd><p><em>s</em> will be converted to a string by calling <aclass="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">str</span></code></a>.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.container.ErrorbarContainer">
<emclass="property">class </em><codeclass="descclassname">matplotlib.container.</code><codeclass="descname">ErrorbarContainer</code><spanclass="sig-paren">(</span><em><spanclass="o">*</span><spanclass="n">args</span></em>, <em><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/container.html#ErrorbarContainer"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.container.ErrorbarContainer" title="Permalink to this definition">¶</a></dt>
<p>Container for the artists of error bars (e.g. created by <aclass="reference internal" href="_as_gen/matplotlib.axes.Axes.errorbar.html#matplotlib.axes.Axes.errorbar" title="matplotlib.axes.Axes.errorbar"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Axes.errorbar</span></code></a>).</p>
<p>The container can be treated as the <em>lines</em> tuple itself.
Additionally, you can access these and further parameters by the
<trclass="field-odd field"><thclass="field-name">Attributes:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>lines</strong><spanclass="classifier">tuple</span></dt><dd><p>Tuple of <codeclass="docutils literal notranslate"><spanclass="pre">(data_line,</span><spanclass="pre">caplines,</span><spanclass="pre">barlinecols)</span></code>.</p>
<li>caplines : tuple of <aclass="reference internal" href="_as_gen/matplotlib.lines.Line2D.html#matplotlib.lines.Line2D" title="matplotlib.lines.Line2D"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Line2D</span></code></a> instances of
the error bar caps.</li>
<li>barlinecols : list of <aclass="reference internal" href="collections_api.html#matplotlib.collections.LineCollection" title="matplotlib.collections.LineCollection"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">LineCollection</span></code></a>
with the horizontal and vertical error ranges.</li>
</ul>
</dd>
<dt><strong>has_xerr, has_yerr</strong><spanclass="classifier">bool</span></dt><dd><p><codeclass="docutils literal notranslate"><spanclass="pre">True</span></code> if the errorbar has x/y errors.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.container.StemContainer">
<emclass="property">class </em><codeclass="descclassname">matplotlib.container.</code><codeclass="descname">StemContainer</code><spanclass="sig-paren">(</span><em><spanclass="o">*</span><spanclass="n">args</span></em>, <em><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/container.html#StemContainer"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.container.StemContainer" title="Permalink to this definition">¶</a></dt>
<p>Container for the artists created in a <aclass="reference internal" href="_as_gen/matplotlib.axes.Axes.stem.html#matplotlib.axes.Axes.stem" title="matplotlib.axes.Axes.stem"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">Axes.stem()</span></code></a> plot.</p>
<p>The container can be treated like a namedtuple <codeclass="docutils literal notranslate"><spanclass="pre">(markerline,</span><spanclass="pre">stemlines,</span>
<trclass="field-odd field"><thclass="field-name">Attributes:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>markerline</strong><spanclass="classifier"><aclass="reference internal" href="_as_gen/matplotlib.lines.Line2D.html#matplotlib.lines.Line2D" title="matplotlib.lines.Line2D"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Line2D</span></code></a></span></dt><dd><p>The artist of the markers at the stem heads.</p>
</dd>
<dt><strong>stemlines</strong><spanclass="classifier">list of <aclass="reference internal" href="_as_gen/matplotlib.lines.Line2D.html#matplotlib.lines.Line2D" title="matplotlib.lines.Line2D"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Line2D</span></code></a></span></dt><dd><p>The artists of the vertical lines for all stems.</p>
</dd>
<dt><strong>baseline</strong><spanclass="classifier"><aclass="reference internal" href="_as_gen/matplotlib.lines.Line2D.html#matplotlib.lines.Line2D" title="matplotlib.lines.Line2D"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Line2D</span></code></a></span></dt><dd><p>The artist of the horizontal baseline.</p>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>markerline_stemlines_baseline</strong><spanclass="classifier">tuple</span></dt><dd><p>Tuple of <codeclass="docutils literal notranslate"><spanclass="pre">(markerline,</span><spanclass="pre">stemlines,</span><spanclass="pre">baseline)</span></code>.
<codeclass="docutils literal notranslate"><spanclass="pre">markerline</span></code> contains the <aclass="reference internal" href="collections_api.html#matplotlib.collections.LineCollection" title="matplotlib.collections.LineCollection"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">LineCollection</span></code></a> of the markers,
<codeclass="docutils literal notranslate"><spanclass="pre">stemlines</span></code> is a <aclass="reference internal" href="collections_api.html#matplotlib.collections.LineCollection" title="matplotlib.collections.LineCollection"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">LineCollection</span></code></a> of the main lines,
<codeclass="docutils literal notranslate"><spanclass="pre">baseline</span></code> is the <aclass="reference internal" href="_as_gen/matplotlib.lines.Line2D.html#matplotlib.lines.Line2D" title="matplotlib.lines.Line2D"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Line2D</span></code></a> of the baseline.</p>