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.2.2). For the latest version see <ahref="https://matplotlib.org/stable/api/dates_api.html">https://matplotlib.org/stable/api/dates_api.html</a></div>
<h1><codeclass="docutils literal notranslate"><spanclass="pre">matplotlib.dates</span></code><aclass="headerlink" href="#matplotlib-dates" title="Permalink to this headline">¶</a></h1>
<pclass="warning">Inheritance diagram of matplotlib.dates</p></object></div>
<spanclass="target" id="module-matplotlib.dates"></span><p>Matplotlib provides sophisticated date plotting capabilities, standing on the
shoulders of python <aclass="reference external" href="https://docs.python.org/3/library/datetime.html#module-datetime" title="(in Python v3.8)"><codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">datetime</span></code></a> and the add-on module <codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">dateutil</span></code>.</p>
<divclass="section" id="matplotlib-date-format">
<spanid="date-format"></span><h2>Matplotlib date format<aclass="headerlink" href="#matplotlib-date-format" title="Permalink to this headline">¶</a></h2>
<p>Matplotlib represents dates using floating point numbers specifying the number
of days since 0001-01-01 UTC, plus 1. For example, 0001-01-01, 06:00 is 1.25,
not 0.25. Values < 1, i.e. dates before 0001-01-01 UTC, are not supported.</p>
<p>There are a number of helper functions to convert between <aclass="reference external" href="https://docs.python.org/3/library/datetime.html#module-datetime" title="(in Python v3.8)"><codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">datetime</span></code></a>
<td>Convert a date string to a datenum using <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">dateutil.parser.parse()</span></code>.</td>
<td>Convert number of days to a <aclass="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.timedelta" title="(in Python v3.8)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">timedelta</span></code></a> object.</td>
<p>All the Matplotlib date converters, tickers and formatters are timezone aware.
If no explicit timezone is provided, <codeclass="docutils literal notranslate"><aclass="reference external" href="../tutorials/introductory/customizing.html?highlight=timezone#a-sample-matplotlibrc-file"><spanclass="pre">rcParams["timezone"]</span></a></code> (default: 'UTC') is assumed. If you want to
use a custom time zone, pass a <aclass="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.tzinfo" title="(in Python v3.8)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">datetime.tzinfo</span></code></a> instance with the tz keyword
argument to <aclass="reference internal" href="#matplotlib.dates.num2date" title="matplotlib.dates.num2date"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">num2date</span></code></a>, <aclass="reference internal" href="_as_gen/matplotlib.axes.Axes.plot_date.html#matplotlib.axes.Axes.plot_date" title="matplotlib.axes.Axes.plot_date"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">plot_date</span></code></a>, and any custom date tickers or
locators you create.</p>
<p>A wide range of specific and general purpose date tick locators and
formatters are provided in this module. See
<aclass="reference internal" href="ticker_api.html#module-matplotlib.ticker" title="matplotlib.ticker"><codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">matplotlib.ticker</span></code></a> for general information on tick locators
and formatters. These are described below.</p>
<p>The <aclass="reference external" href="https://dateutil.readthedocs.io">dateutil</a> module provides additional code to handle date ticking, making it
easy to place ticks on any kinds of dates. See examples below.</p>
</div>
<divclass="section" id="date-tickers">
<h2>Date tickers<aclass="headerlink" href="#date-tickers" title="Permalink to this headline">¶</a></h2>
<p>Most of the date tickers can locate single or multiple values. For
example:</p>
<divclass="highlight-default notranslate"><divclass="highlight"><pre><span></span><spanclass="c1"># import constants for the days of the week</span>
<li><aclass="reference internal" href="#matplotlib.dates.DayLocator" title="matplotlib.dates.DayLocator"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">DayLocator</span></code></a>: locate specified days of the month</li>
<li><aclass="reference internal" href="#matplotlib.dates.WeekdayLocator" title="matplotlib.dates.WeekdayLocator"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">WeekdayLocator</span></code></a>: Locate days of the week, e.g., MO, TU</li>
<li><aclass="reference internal" href="#matplotlib.dates.YearLocator" title="matplotlib.dates.YearLocator"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">YearLocator</span></code></a>: locate years that are multiples of base</li>
<li><aclass="reference internal" href="#matplotlib.dates.RRuleLocator" title="matplotlib.dates.RRuleLocator"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">RRuleLocator</span></code></a>: locate using a <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">matplotlib.dates.rrulewrapper</span></code>.
<codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">rrulewrapper</span></code> is a simple wrapper around <aclass="reference external" href="https://dateutil.readthedocs.io">dateutil</a>'s <aclass="reference external" href="https://dateutil.readthedocs.io/en/stable/rrule.html#module-dateutil.rrule" title="(in dateutil v2.8.1)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">dateutil.rrule</span></code></a> which
allow almost arbitrary date tick specifications. See <aclass="reference internal" href="../gallery/ticks_and_spines/date_demo_rrule.html"><spanclass="doc">rrule example</span></a>.</li>
<li><aclass="reference internal" href="#matplotlib.dates.AutoDateLocator" title="matplotlib.dates.AutoDateLocator"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">AutoDateLocator</span></code></a>: On autoscale, this class picks the best <aclass="reference internal" href="#matplotlib.dates.DateLocator" title="matplotlib.dates.DateLocator"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">DateLocator</span></code></a>
(e.g., <aclass="reference internal" href="#matplotlib.dates.RRuleLocator" title="matplotlib.dates.RRuleLocator"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">RRuleLocator</span></code></a>) to set the view limits and the tick locations. If
called with <codeclass="docutils literal notranslate"><spanclass="pre">interval_multiples=True</span></code> it will make ticks line up with
sensible multiples of the tick intervals. E.g. if the interval is 4 hours,
it will pick hours 0, 4, 8, etc as ticks. This behaviour is not guaranteed
by default.</li>
</ul>
</div>
<divclass="section" id="date-formatters">
<h2>Date formatters<aclass="headerlink" href="#date-formatters" title="Permalink to this headline">¶</a></h2>
<p>The available date formatters are:</p>
<ulclass="simple">
<li><aclass="reference internal" href="#matplotlib.dates.AutoDateFormatter" title="matplotlib.dates.AutoDateFormatter"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">AutoDateFormatter</span></code></a>: attempts to figure out the best format to use. This is
most useful when used with the <aclass="reference internal" href="#matplotlib.dates.AutoDateLocator" title="matplotlib.dates.AutoDateLocator"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">AutoDateLocator</span></code></a>.</li>
<li><aclass="reference internal" href="#matplotlib.dates.ConciseDateFormatter" title="matplotlib.dates.ConciseDateFormatter"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">ConciseDateFormatter</span></code></a>: also attempts to figure out the best format to use,
and to make the format as compact as possible while still having complete
date information. This is most useful when used with the <aclass="reference internal" href="#matplotlib.dates.AutoDateLocator" title="matplotlib.dates.AutoDateLocator"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">AutoDateLocator</span></code></a>.</li>
<p>This class attempts to figure out the best format to use. This is
most useful when used with the <aclass="reference internal" href="#matplotlib.dates.AutoDateLocator" title="matplotlib.dates.AutoDateLocator"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">AutoDateLocator</span></code></a>.</p>
<p>The AutoDateFormatter has a scale dictionary that maps the scale
of the tick (the distance in days between one major tick) and a
<spanclass="gp">>>> </span><spanclass="n">formatter</span><spanclass="o">.</span><spanclass="n">scaled</span><spanclass="p">[</span><spanclass="mi">1</span><spanclass="o">/</span><spanclass="p">(</span><spanclass="mf">24.</span><spanclass="o">*</span><spanclass="mf">60.</span><spanclass="p">)]</span><spanclass="o">=</span><spanclass="s1">'%M:%S'</span><spanclass="c1"># only show min and sec</span>
</pre></div>
</div>
<p>A custom <aclass="reference internal" href="ticker_api.html#matplotlib.ticker.FuncFormatter" title="matplotlib.ticker.FuncFormatter"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">FuncFormatter</span></code></a> can also be used. The following example shows
how to use a custom format function to strip trailing zeros from decimal
seconds and adds the date to the first ticklabel:</p>
<p>On autoscale, this class picks the best <aclass="reference internal" href="#matplotlib.dates.DateLocator" title="matplotlib.dates.DateLocator"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">DateLocator</span></code></a> to set the view
<spanclass="n">locator</span><spanclass="o">.</span><spanclass="n">intervald</span><spanclass="p">[</span><spanclass="n">HOURLY</span><spanclass="p">]</span><spanclass="o">=</span><spanclass="p">[</span><spanclass="mi">3</span><spanclass="p">]</span><spanclass="c1"># only show every 3 hours</span>
<dt><strong>minticks</strong><spanclass="classifier">int</span></dt><dd><p>The minimum number of ticks desired; controls whether ticks occur
yearly, monthly, etc.</p>
</dd>
<dt><strong>maxticks</strong><spanclass="classifier">int</span></dt><dd><p>The maximum number of ticks desired; controls the interval between
ticks (ticking every other, every 3, etc.). For fine-grained
control, this can be a dictionary mapping individual rrule
frequency constants (YEARLY, MONTHLY, etc.) to their own maximum
number of ticks. This can be used to keep the number of ticks
appropriate to the format chosen in <aclass="reference internal" href="#matplotlib.dates.AutoDateFormatter" title="matplotlib.dates.AutoDateFormatter"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">AutoDateFormatter</span></code></a>. Any
frequency not specified in this dictionary is given a default
value.</p>
</dd>
<dt><strong>interval_multiples</strong><spanclass="classifier">bool, default: True</span></dt><dd><p>Whether ticks should be chosen to be multiple of the interval,
locking them to 'nicer' locations. For example, this will force
the ticks to be at hours 0, 6, 12, 18 when hourly ticking is done
<codeclass="descname">autoscale</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#AutoDateLocator.autoscale"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.AutoDateLocator.autoscale" title="Permalink to this definition">¶</a></dt>
<dd><p>[<em>Deprecated</em>] Try to choose the view limits intelligently.</p>
<pclass="rubric">Notes</p>
<divclass="deprecated">
<p><spanclass="versionmodified deprecated">Deprecated since version 3.2.</span></p>
<codeclass="descname">get_locator</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">dmin</span></em>, <em><spanclass="n">dmax</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#AutoDateLocator.get_locator"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.AutoDateLocator.get_locator" title="Permalink to this definition">¶</a></dt>
<dd><p>Pick the best locator based on a distance.</p>
<codeclass="descname">nonsingular</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">vmin</span></em>, <em><spanclass="n">vmax</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#AutoDateLocator.nonsingular"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.AutoDateLocator.nonsingular" title="Permalink to this definition">¶</a></dt>
<dd><p>Given the proposed upper and lower extent, adjust the range
if it is too close to being singular (i.e. a range of ~0).</p>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.dates.AutoDateLocator.refresh">
<codeclass="descname">refresh</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#AutoDateLocator.refresh"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.AutoDateLocator.refresh" title="Permalink to this definition">¶</a></dt>
<dd><p>Refresh internal information based on current limits.</p>
<codeclass="descname">set_axis</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">axis</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#AutoDateLocator.set_axis"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.AutoDateLocator.set_axis" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">tick_values</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">vmin</span></em>, <em><spanclass="n">vmax</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#AutoDateLocator.tick_values"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.AutoDateLocator.tick_values" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the values of the located ticks given <strong>vmin</strong> and <strong>vmax</strong>.</p>
<divclass="admonition note">
<pclass="first admonition-title">Note</p>
<p>To get tick locations with the vmin and vmax values defined
automatically for the associated <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">axis</span></code> simply call
<p>This class attempts to figure out the best format to use for the
date, and to make it as compact as possible, but still be complete. This is
most useful when used with the <aclass="reference internal" href="#matplotlib.dates.AutoDateLocator" title="matplotlib.dates.AutoDateLocator"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">AutoDateLocator</span></code></a>:</p>
<trclass="field-odd field"><thclass="field-name">Parameters:</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">ticker.Locator</span></code></a></span></dt><dd><p>Locator that this axis is using.</p>
<dt><strong>formats</strong><spanclass="classifier">list of 6 strings, optional</span></dt><dd><p>Format strings for 6 levels of tick labelling: mostly years,
months, days, hours, minutes, and seconds. Strings use
the same format codes as <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">strftime</span></code>. Default is
<dt><strong>zero_formats</strong><spanclass="classifier">list of 6 strings, optional</span></dt><dd><p>Format strings for tick labels that are "zeros" for a given tick
level. For instance, if most ticks are months, ticks around 1 Jan 2005
will be labeled "Dec", "2005", "Feb". The default is
<dt><strong>offset_formats</strong><spanclass="classifier">list of 6 strings, optional</span></dt><dd><p>Format strings for the 6 levels that is applied to the "offset"
string found on the right side of an x-axis, or top of a y-axis.
Combined with the tick labels this should completely specify the
<dt><strong>show_offset</strong><spanclass="classifier">bool</span></dt><dd><p>Whether to show the offset or not. Default is <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<pclass="rubric">Examples</p>
<p>See <aclass="reference internal" href="../gallery/ticks_and_spines/date_concise_formatter.html"><spanclass="doc">Formatting date ticks using ConciseDateFormatter</span></a></p>
<codeclass="descname">format_data_short</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">value</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#ConciseDateFormatter.format_data_short"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.ConciseDateFormatter.format_data_short" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a short string version of the tick value.</p>
<p>Defaults to the position-independent long value.</p>
<codeclass="descname">format_ticks</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">values</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#ConciseDateFormatter.format_ticks"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.ConciseDateFormatter.format_ticks" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the tick labels for all the ticks at once.</p>
<codeclass="descname">get_offset</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#ConciseDateFormatter.get_offset"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.ConciseDateFormatter.get_offset" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.dates.DateFormatter">
<emclass="property">class </em><codeclass="descclassname">matplotlib.dates.</code><codeclass="descname">DateFormatter</code><spanclass="sig-paren">(</span><em><spanclass="n">fmt</span></em>, <em><spanclass="n">tz</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#DateFormatter"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.DateFormatter" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">illegal_s</code><emclass="property"> = re.compile('((^|[^%])(%%)*%s)')</em><aclass="headerlink" href="#matplotlib.dates.DateFormatter.illegal_s" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">set_tzinfo</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">tz</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#DateFormatter.set_tzinfo"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.DateFormatter.set_tzinfo" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.dates.DateLocator">
<emclass="property">class </em><codeclass="descclassname">matplotlib.dates.</code><codeclass="descname">DateLocator</code><spanclass="sig-paren">(</span><em><spanclass="n">tz</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#DateLocator"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.DateLocator" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">datalim_to_dt</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#DateLocator.datalim_to_dt"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.DateLocator.datalim_to_dt" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert axis data interval to datetime objects.</p>
</dd></dl>
<dlclass="py attribute">
<dtid="matplotlib.dates.DateLocator.hms0d">
<codeclass="descname">hms0d</code><emclass="property"> = {'byhour': 0, 'byminute': 0, 'bysecond': 0}</em><aclass="headerlink" href="#matplotlib.dates.DateLocator.hms0d" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="py method">
<dtid="matplotlib.dates.DateLocator.nonsingular">
<codeclass="descname">nonsingular</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">vmin</span></em>, <em><spanclass="n">vmax</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#DateLocator.nonsingular"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.DateLocator.nonsingular" title="Permalink to this definition">¶</a></dt>
<dd><p>Given the proposed upper and lower extent, adjust the range
if it is too close to being singular (i.e. a range of ~0).</p>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.dates.DateLocator.set_tzinfo">
<codeclass="descname">set_tzinfo</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">tz</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#DateLocator.set_tzinfo"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.DateLocator.set_tzinfo" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">viewlim_to_dt</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#DateLocator.viewlim_to_dt"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.DateLocator.viewlim_to_dt" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the view interval to datetime objects.</p>
</dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.dates.DayLocator">
<emclass="property">class </em><codeclass="descclassname">matplotlib.dates.</code><codeclass="descname">DayLocator</code><spanclass="sig-paren">(</span><em><spanclass="n">bymonthday</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">interval</span><spanclass="o">=</span><spanclass="default_value">1</span></em>, <em><spanclass="n">tz</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#DayLocator"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.DayLocator" title="Permalink to this definition">¶</a></dt>
<p>Make ticks on occurrences of each day of the month. For example,
1, 15, 30.</p>
<p>Mark every day in <em>bymonthday</em>; <em>bymonthday</em> can be an int or sequence.</p>
<p>Default is to tick every day of the month: <codeclass="docutils literal notranslate"><spanclass="pre">bymonthday=range(1,</span><spanclass="pre">32)</span></code>.</p>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.dates.HourLocator">
<emclass="property">class </em><codeclass="descclassname">matplotlib.dates.</code><codeclass="descname">HourLocator</code><spanclass="sig-paren">(</span><em><spanclass="n">byhour</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">interval</span><spanclass="o">=</span><spanclass="default_value">1</span></em>, <em><spanclass="n">tz</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#HourLocator"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.HourLocator" title="Permalink to this definition">¶</a></dt>
<p>Use with <aclass="reference internal" href="ticker_api.html#matplotlib.ticker.IndexLocator" title="matplotlib.ticker.IndexLocator"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">IndexLocator</span></code></a> to cycle format strings by index.</p>
<p><em>t</em> is a sequence of dates (floating point days). <em>fmt</em> is a
<emclass="property">class </em><codeclass="descclassname">matplotlib.dates.</code><codeclass="descname">MicrosecondLocator</code><spanclass="sig-paren">(</span><em><spanclass="n">interval</span><spanclass="o">=</span><spanclass="default_value">1</span></em>, <em><spanclass="n">tz</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#MicrosecondLocator"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.MicrosecondLocator" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">set_axis</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">axis</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#MicrosecondLocator.set_axis"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.MicrosecondLocator.set_axis" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">set_data_interval</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">vmin</span></em>, <em><spanclass="n">vmax</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#MicrosecondLocator.set_data_interval"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.MicrosecondLocator.set_data_interval" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">set_view_interval</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">vmin</span></em>, <em><spanclass="n">vmax</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#MicrosecondLocator.set_view_interval"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.MicrosecondLocator.set_view_interval" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">tick_values</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">vmin</span></em>, <em><spanclass="n">vmax</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#MicrosecondLocator.tick_values"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.MicrosecondLocator.tick_values" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the values of the located ticks given <strong>vmin</strong> and <strong>vmax</strong>.</p>
<divclass="admonition note">
<pclass="first admonition-title">Note</p>
<p>To get tick locations with the vmin and vmax values defined
automatically for the associated <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">axis</span></code> simply call
<p>Make ticks on occurrences of each month, e.g., 1, 3, 12.</p>
<p>Mark every month in <em>bymonth</em>; <em>bymonth</em> can be an int or
sequence. Default is <codeclass="docutils literal notranslate"><spanclass="pre">range(1,</span><spanclass="pre">13)</span></code>, i.e. every month.</p>
<p><em>interval</em> is the interval between each iteration. For
example, if <codeclass="docutils literal notranslate"><spanclass="pre">interval=2</span></code>, mark every second occurrence.</p>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.dates.RRuleLocator">
<emclass="property">class </em><codeclass="descclassname">matplotlib.dates.</code><codeclass="descname">RRuleLocator</code><spanclass="sig-paren">(</span><em><spanclass="n">o</span></em>, <em><spanclass="n">tz</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#RRuleLocator"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.RRuleLocator" title="Permalink to this definition">¶</a></dt>
<p><em>tz</em> is a <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">tzinfo</span></code> instance.</p>
<dlclass="py method">
<dtid="matplotlib.dates.RRuleLocator.autoscale">
<codeclass="descname">autoscale</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#RRuleLocator.autoscale"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.RRuleLocator.autoscale" title="Permalink to this definition">¶</a></dt>
<dd><p>[<em>Deprecated</em>] Set the view limits to include the data range.</p>
<pclass="rubric">Notes</p>
<divclass="deprecated">
<p><spanclass="versionmodified deprecated">Deprecated since version 3.2.</span></p>
<emclass="property">static </em><codeclass="descname">get_unit_generic</code><spanclass="sig-paren">(</span><em><spanclass="n">freq</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#RRuleLocator.get_unit_generic"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.RRuleLocator.get_unit_generic" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">tick_values</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">vmin</span></em>, <em><spanclass="n">vmax</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#RRuleLocator.tick_values"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.RRuleLocator.tick_values" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the values of the located ticks given <strong>vmin</strong> and <strong>vmax</strong>.</p>
<divclass="admonition note">
<pclass="first admonition-title">Note</p>
<p>To get tick locations with the vmin and vmax values defined
automatically for the associated <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">axis</span></code> simply call
<p>Mark every second in <em>bysecond</em>; <em>bysecond</em> can be an int or
sequence. Default is to tick every second: <codeclass="docutils literal notranslate"><spanclass="pre">bysecond</span><spanclass="pre">=</span><spanclass="pre">range(60)</span></code></p>
<p><em>interval</em> is the interval between each iteration. For
example, if <codeclass="docutils literal notranslate"><spanclass="pre">interval=2</span></code>, mark every second occurrence.</p>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.dates.WeekdayLocator">
<emclass="property">class </em><codeclass="descclassname">matplotlib.dates.</code><codeclass="descname">WeekdayLocator</code><spanclass="sig-paren">(</span><em><spanclass="n">byweekday</span><spanclass="o">=</span><spanclass="default_value">1</span></em>, <em><spanclass="n">interval</span><spanclass="o">=</span><spanclass="default_value">1</span></em>, <em><spanclass="n">tz</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#WeekdayLocator"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.WeekdayLocator" title="Permalink to this definition">¶</a></dt>
<p>Mark every weekday in <em>byweekday</em>; <em>byweekday</em> can be a number or
sequence.</p>
<p>Elements of <em>byweekday</em> must be one of MO, TU, WE, TH, FR, SA,
SU, the constants from <aclass="reference external" href="https://dateutil.readthedocs.io/en/stable/rrule.html#module-dateutil.rrule" title="(in dateutil v2.8.1)"><codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">dateutil.rrule</span></code></a>, which have been
imported into the <aclass="reference internal" href="#module-matplotlib.dates" title="matplotlib.dates"><codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">matplotlib.dates</span></code></a> namespace.</p>
<p><em>interval</em> specifies the number of weeks to skip. For example,
<codeclass="docutils literal notranslate"><spanclass="pre">interval=2</span></code> plots every second week.</p>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.dates.YearLocator">
<emclass="property">class </em><codeclass="descclassname">matplotlib.dates.</code><codeclass="descname">YearLocator</code><spanclass="sig-paren">(</span><em><spanclass="n">base</span><spanclass="o">=</span><spanclass="default_value">1</span></em>, <em><spanclass="n">month</span><spanclass="o">=</span><spanclass="default_value">1</span></em>, <em><spanclass="n">day</span><spanclass="o">=</span><spanclass="default_value">1</span></em>, <em><spanclass="n">tz</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#YearLocator"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.YearLocator" title="Permalink to this definition">¶</a></dt>
<p>Mark years that are multiple of base on a given month and day
(default jan 1).</p>
<dlclass="py method">
<dtid="matplotlib.dates.YearLocator.autoscale">
<codeclass="descname">autoscale</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#YearLocator.autoscale"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.YearLocator.autoscale" title="Permalink to this definition">¶</a></dt>
<dd><p>[<em>Deprecated</em>] Set the view limits to include the data range.</p>
<pclass="rubric">Notes</p>
<divclass="deprecated">
<p><spanclass="versionmodified deprecated">Deprecated since version 3.2.</span></p>
</div>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.dates.YearLocator.tick_values">
<codeclass="descname">tick_values</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">vmin</span></em>, <em><spanclass="n">vmax</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#YearLocator.tick_values"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.YearLocator.tick_values" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the values of the located ticks given <strong>vmin</strong> and <strong>vmax</strong>.</p>
<divclass="admonition note">
<pclass="first admonition-title">Note</p>
<p>To get tick locations with the vmin and vmax values defined
automatically for the associated <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">axis</span></code> simply call
<codeclass="descclassname">matplotlib.dates.</code><codeclass="descname">date2num</code><spanclass="sig-paren">(</span><em><spanclass="n">d</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#date2num"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.date2num" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert datetime objects to Matplotlib dates.</p>
<dt><strong>d</strong><spanclass="classifier"><aclass="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.datetime" title="(in Python v3.8)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">datetime.datetime</span></code></a> or <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">numpy.datetime64</span></code> or sequences of these</span></dt><dd></dd>
</dl>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><dlclass="first last docutils">
<dt>float or sequence of floats</dt><dd><p>Number of days (fraction part represents hours, minutes, seconds, ms)
since 0001-01-01 00:00:00 UTC, plus one.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<pclass="rubric">Notes</p>
<p>The addition of one here is a historical artifact. Also, note that the
Gregorian calendar is assumed; this is not universal practice.
For details see the module docstring.</p>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.dates.datestr2num">
<codeclass="descclassname">matplotlib.dates.</code><codeclass="descname">datestr2num</code><spanclass="sig-paren">(</span><em><spanclass="n">d</span></em>, <em><spanclass="n">default</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#datestr2num"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.datestr2num" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a date string to a datenum using <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">dateutil.parser.parse()</span></code>.</p>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>d</strong><spanclass="classifier">str or sequence of str</span></dt><dd><p>The dates to convert.</p>
</dd>
<dt><strong>default</strong><spanclass="classifier">datetime instance, optional</span></dt><dd><p>The default date to use when fields are missing in <em>d</em>.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.dates.drange">
<codeclass="descclassname">matplotlib.dates.</code><codeclass="descname">drange</code><spanclass="sig-paren">(</span><em><spanclass="n">dstart</span></em>, <em><spanclass="n">dend</span></em>, <em><spanclass="n">delta</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#drange"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.drange" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a sequence of equally spaced Matplotlib dates.</p>
<p>The dates start at <em>dstart</em> and reach up to, but not including <em>dend</em>.
<codeclass="descclassname">matplotlib.dates.</code><codeclass="descname">epoch2num</code><spanclass="sig-paren">(</span><em><spanclass="n">e</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#epoch2num"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.epoch2num" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert an epoch or sequence of epochs to the new date format,
that is days since 0001.</p>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.dates.hours">
<codeclass="descclassname">matplotlib.dates.</code><codeclass="descname">hours</code><spanclass="sig-paren">(</span><em><spanclass="n">h</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#hours"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.hours" title="Permalink to this definition">¶</a></dt>
<dd><p>[<em>Deprecated</em>] Return hours as days.</p>
<pclass="rubric">Notes</p>
<divclass="deprecated">
<p><spanclass="versionmodified deprecated">Deprecated since version 3.1.</span></p>
</div>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.dates.minutes">
<codeclass="descclassname">matplotlib.dates.</code><codeclass="descname">minutes</code><spanclass="sig-paren">(</span><em><spanclass="n">m</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#minutes"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.minutes" title="Permalink to this definition">¶</a></dt>
<dd><p>[<em>Deprecated</em>] Return minutes as days.</p>
<pclass="rubric">Notes</p>
<divclass="deprecated">
<p><spanclass="versionmodified deprecated">Deprecated since version 3.1.</span></p>
</div>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.dates.mx2num">
<codeclass="descclassname">matplotlib.dates.</code><codeclass="descname">mx2num</code><spanclass="sig-paren">(</span><em><spanclass="n">mxdates</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#mx2num"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.mx2num" title="Permalink to this definition">¶</a></dt>
<p><spanclass="versionmodified deprecated">Deprecated since version 3.2.</span></p>
</div>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.dates.num2date">
<codeclass="descclassname">matplotlib.dates.</code><codeclass="descname">num2date</code><spanclass="sig-paren">(</span><em><spanclass="n">x</span></em>, <em><spanclass="n">tz</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#num2date"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.num2date" title="Permalink to this definition">¶</a></dt>
<dt><strong>x</strong><spanclass="classifier">float or sequence of floats</span></dt><dd><p>Number of days (fraction part represents hours, minutes, seconds)
since 0001-01-01 00:00:00 UTC, plus one.</p>
</dd>
<dt><strong>tz</strong><spanclass="classifier">str, optional</span></dt><dd><p>Timezone of <em>x</em> (defaults to rcparams <codeclass="docutils literal notranslate"><spanclass="pre">timezone</span></code>).</p>
</dd>
</dl>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><aclass="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.datetime" title="(in Python v3.8)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">datetime</span></code></a> or sequence of <aclass="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.datetime" title="(in Python v3.8)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">datetime</span></code></a></dt><dd><p>Dates are returned in timezone <em>tz</em>.</p>
<p>If <em>x</em> is a sequence, a sequence of <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">datetime</span></code> objects will
be returned.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<pclass="rubric">Notes</p>
<p>The addition of one here is a historical artifact. Also, note that the
Gregorian calendar is assumed; this is not universal practice.
For details, see the module docstring.</p>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.dates.num2epoch">
<codeclass="descclassname">matplotlib.dates.</code><codeclass="descname">num2epoch</code><spanclass="sig-paren">(</span><em><spanclass="n">d</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#num2epoch"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.num2epoch" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert days since 0001 to epoch. <em>d</em> can be a number or sequence.</p>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.dates.num2timedelta">
<codeclass="descclassname">matplotlib.dates.</code><codeclass="descname">num2timedelta</code><spanclass="sig-paren">(</span><em><spanclass="n">x</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dates.html#num2timedelta"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dates.num2timedelta" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert number of days to a <aclass="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.timedelta" title="(in Python v3.8)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">timedelta</span></code></a> object.</p>
<p>If <em>x</em> is a sequence, a sequence of <aclass="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.timedelta" title="(in Python v3.8)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">timedelta</span></code></a> objects will
<dt><strong>x</strong><spanclass="classifier">float, sequence of floats</span></dt><dd><p>Number of days. The fraction part represents hours, minutes, seconds.</p>
</dd>
</dl>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><dlclass="first last docutils">