You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
<divid="unreleased-message"> You are reading an old version of the documentation (v3.3.3). For the latest version see <ahref="https://matplotlib.org/stable/api/axis_api.html">https://matplotlib.org/stable/api/axis_api.html</a></div>
<h1><codeclass="docutils literal notranslate"><spanclass="pre">matplotlib.axis</span></code><aclass="headerlink" href="#matplotlib-axis" title="Permalink to this headline">¶</a></h1>
<divclass="contents local topic" id="table-of-contents">
<areashape="rect" id="node1" href="artist_api.html#matplotlib.artist.Artist" target="_top" title="Abstract base class for objects that render into a FigureCanvas." alt="" coords="5,85,239,116"/>
<areashape="rect" id="node2" href="#matplotlib.axis.Axis" target="_top" title="Base class for `.XAxis` and `.YAxis`." alt="" coords="282,58,494,90"/>
<areashape="rect" id="node3" href="#matplotlib.axis.Tick" target="_top" title="Abstract base class for the axis ticks, grid lines and labels." alt="" coords="283,111,493,143"/>
<areashape="rect" id="node6" href="#matplotlib.axis.XTick" target="_top" title="Contains all the Artists needed to make an x tick - the tick line," alt="" coords="540,111,761,143"/>
<areashape="rect" id="node8" href="#matplotlib.axis.YTick" target="_top" title="Contains all the Artists needed to make a Y tick - the tick line," alt="" coords="540,165,761,196"/>
<areashape="rect" id="node4" href="#matplotlib.axis.Ticker" target="_top" title="A container for the objects defining tick position and format." alt="" coords="7,31,236,63"/>
</map></div>
<divclass="section" id="axis-objects">
<h2><aclass="toc-backref" href="#id2"><codeclass="docutils literal notranslate"><spanclass="pre">Axis</span></code> objects</a><aclass="headerlink" href="#axis-objects" title="Permalink to this headline">¶</a></h2>
<dlclass="py class">
<dtid="matplotlib.axis.Axis">
<emclass="property">class </em><codeclass="descclassname">matplotlib.axis.</code><codeclass="descname">Axis</code><spanclass="sig-paren">(</span><em><spanclass="n">axes</span></em>, <em><spanclass="n">pickradius</span><spanclass="o">=</span><spanclass="default_value">15</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/axis.html#Axis"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.axis.Axis" title="Permalink to this definition">¶</a></dt>
<dd><p>Base class for <aclass="reference internal" href="#matplotlib.axis.XAxis" title="matplotlib.axis.XAxis"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">XAxis</span></code></a> and <aclass="reference internal" href="#matplotlib.axis.YAxis" title="matplotlib.axis.YAxis"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">YAxis</span></code></a>.</p>
<dt><aclass="reference internal" href="_as_gen/matplotlib.axis.Axis.axes.html#matplotlib.axis.Axis.axes" title="matplotlib.axis.Axis.axes"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">axes</span></code></a><spanclass="classifier"><aclass="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">matplotlib.axes.Axes</span></code></a></span></dt><dd><p>The <aclass="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Axes</span></code></a> instance the artist resides in, or <em>None</em>.</p>
</dd>
<dt><strong>major</strong><spanclass="classifier"><aclass="reference internal" href="#matplotlib.axis.Ticker" title="matplotlib.axis.Ticker"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">matplotlib.axis.Ticker</span></code></a></span></dt><dd><p>Determines the major tick positions and their label format.</p>
</dd>
<dt><strong>minor</strong><spanclass="classifier"><aclass="reference internal" href="#matplotlib.axis.Ticker" title="matplotlib.axis.Ticker"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">matplotlib.axis.Ticker</span></code></a></span></dt><dd><p>Determines the minor tick positions and their label format.</p>
<emclass="property">class </em><codeclass="descclassname">matplotlib.axis.</code><codeclass="descname">XAxis</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/axis.html#XAxis"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.axis.XAxis" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="descclassname">matplotlib.axis.</code><codeclass="descname">YAxis</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/axis.html#YAxis"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.axis.YAxis" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="descclassname">matplotlib.axis.</code><codeclass="descname">Ticker</code><aclass="reference internal" href="../_modules/matplotlib/axis.html#Ticker"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.axis.Ticker" title="Permalink to this definition">¶</a></dt>
<dd><p>A container for the objects defining tick position and format.</p>
<trclass="field-odd field"><thclass="field-name">Attributes:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>locator</strong><spanclass="classifier"><aclass="reference internal" href="ticker_api.html#matplotlib.ticker.Locator" title="matplotlib.ticker.Locator"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">matplotlib.ticker.Locator</span></code></a> subclass</span></dt><dd><p>Determines the positions of the ticks.</p>
</dd>
<dt><strong>formatter</strong><spanclass="classifier"><aclass="reference internal" href="ticker_api.html#matplotlib.ticker.Formatter" title="matplotlib.ticker.Formatter"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">matplotlib.ticker.Formatter</span></code></a> subclass</span></dt><dd><p>Determines the format of the tick labels.</p>
<h3><aclass="toc-backref" href="#id3">Formatters and Locators</a><aclass="headerlink" href="#formatters-and-locators" title="Permalink to this headline">¶</a></h3>
<h3><aclass="toc-backref" href="#id5">Ticks, tick labels and Offset text</a><aclass="headerlink" href="#ticks-tick-labels-and-offset-text" title="Permalink to this headline">¶</a></h3>
<td>Return the list of major <aclass="reference internal" href="#matplotlib.axis.Tick" title="matplotlib.axis.Tick"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Tick</span></code></a>s.</td>
<td>Return this Axis' major tick labels, as a list of <aclass="reference internal" href="text_api.html#matplotlib.text.Text" title="matplotlib.text.Text"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Text</span></code></a>.</td>
<td>Return this Axis' major tick lines as a list of <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>s.</td>
<td>Return the list of minor <aclass="reference internal" href="#matplotlib.axis.Tick" title="matplotlib.axis.Tick"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Tick</span></code></a>s.</td>
<td>Return this Axis' minor tick labels, as a list of <aclass="reference internal" href="text_api.html#matplotlib.text.Text" title="matplotlib.text.Text"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Text</span></code></a>.</td>
<td>Return this Axis' minor tick lines as a list of <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>s.</td>
<td>Return this Axis' tick lines as a list of <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>s.</td>
<td>Return this Axis' grid lines as a list of <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>s.</td>
<td>Sets up axis ticks and labels to treat data along this Axis as dates.</td>
</tr>
</tbody>
</table>
</div>
<divclass="section" id="data-and-view-intervals">
<h3><aclass="toc-backref" href="#id6">Data and view intervals</a><aclass="headerlink" href="#data-and-view-intervals" title="Permalink to this headline">¶</a></h3>
<td>Return the view limits <codeclass="docutils literal notranslate"><spanclass="pre">(min,</span><spanclass="pre">max)</span></code> of this axis.</td>
<h3><aclass="toc-backref" href="#id7">Rendering helpers</a><aclass="headerlink" href="#rendering-helpers" title="Permalink to this headline">¶</a></h3>
<td>Introspect <em>data</em> for units converter and update the axis.converter instance if necessary.</td>
</tr>
</tbody>
</table>
</div>
<divclass="section" id="incremental-navigation">
<h3><aclass="toc-backref" href="#id10">Incremental navigation</a><aclass="headerlink" href="#incremental-navigation" title="Permalink to this headline">¶</a></h3>
<td>The <aclass="reference internal" href="axes_api.html#matplotlib.axes.Axes" title="matplotlib.axes.Axes"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Axes</span></code></a> instance the artist resides in, or <em>None</em>.</td>
<td>[<em>Deprecated</em>] Set the axis to have smart bounds.</td>
</tr>
</tbody>
</table>
</div>
<divclass="section" id="discouraged">
<h3><aclass="toc-backref" href="#id14">Discouraged</a><aclass="headerlink" href="#discouraged" title="Permalink to this headline">¶</a></h3>
<p>These methods should be used together with care, calling <codeclass="docutils literal notranslate"><spanclass="pre">set_ticks</span></code>
to specify the desired tick locations <strong>before</strong> calling <codeclass="docutils literal notranslate"><spanclass="pre">set_ticklabels</span></code> to
specify a matching series of labels. Calling <codeclass="docutils literal notranslate"><spanclass="pre">set_ticks</span></code> makes a
<aclass="reference internal" href="ticker_api.html#matplotlib.ticker.FixedLocator" title="matplotlib.ticker.FixedLocator"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">FixedLocator</span></code></a>; it's list of locations is then used by
<codeclass="docutils literal notranslate"><spanclass="pre">set_ticklabels</span></code> to make an appropriate
<h2><aclass="toc-backref" href="#id15"><codeclass="docutils literal notranslate"><spanclass="pre">Tick</span></code> objects</a><aclass="headerlink" href="#tick-objects" title="Permalink to this headline">¶</a></h2>
<dd><p>Abstract base class for the axis ticks, grid lines and labels.</p>
<p>Ticks mark a position on an Axis. They contain two lines as markers and
two labels; one each for the bottom and top positions (in case of an
<aclass="reference internal" href="#matplotlib.axis.XAxis" title="matplotlib.axis.XAxis"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">XAxis</span></code></a>) or for the left and right positions (in case of a <aclass="reference internal" href="#matplotlib.axis.YAxis" title="matplotlib.axis.YAxis"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">YAxis</span></code></a>).</p>
<p>bbox is the Bound2D bounding box in display coords of the Axes
loc is the tick location in data coords
size is the tick size in points</p>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.axis.XTick">
<emclass="property">class </em><codeclass="descclassname">matplotlib.axis.</code><codeclass="descname">XTick</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/axis.html#XTick"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.axis.XTick" title="Permalink to this definition">¶</a></dt>
<dd><p>Contains all the Artists needed to make an x tick - the tick line,
the label text and the grid line</p>
<p>bbox is the Bound2D bounding box in display coords of the Axes
loc is the tick location in data coords
size is the tick size in points</p>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.axis.YTick">
<emclass="property">class </em><codeclass="descclassname">matplotlib.axis.</code><codeclass="descname">YTick</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/axis.html#YTick"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.axis.YTick" title="Permalink to this definition">¶</a></dt>
<dd><p>Contains all the Artists needed to make a Y tick - the tick line,
the label text and the grid line</p>
<p>bbox is the Bound2D bounding box in display coords of the Axes
<td>Return the view limits <codeclass="docutils literal notranslate"><spanclass="pre">(min,</span><spanclass="pre">max)</span></code> of the axis the tick belongs to.</td>