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 (v1.4.3). For the latest version see <ahref="https://matplotlib.org/stable/api/dates_api.html">https://matplotlib.org/stable/api/dates_api.html</a></div>
<areashape="rect" id="node1" href="#matplotlib.dates.AutoDateFormatter" title="This class attempts to figure out the best format to use.  This is" alt="" coords="316,67,442,89"/>
<areashape="rect" id="node2" href="ticker_api.html#matplotlib.ticker.Formatter" title="Convert the tick location to a string" alt="" coords="186,131,261,153"/>
<areashape="rect" id="node7" href="#matplotlib.dates.DateFormatter" title="Tick location is seconds since the epoch.  Use a :func:`strftime`" alt="" coords="329,110,429,131"/>
<areashape="rect" id="node13" href="#matplotlib.dates.IndexDateFormatter" title="Use with :class:`~matplotlib.ticker.IndexLocator` to cycle format" alt="" coords="314,152,443,174"/>
<areashape="rect" id="node3" href="#matplotlib.dates.AutoDateLocator" title="On autoscale, this class picks the best" alt="" coords="493,130,605,152"/>
<areashape="rect" id="node14" href="#matplotlib.dates.MicrosecondLocator" title="Make ticks on occurances of each microsecond." alt="" coords="485,215,614,237"/>
<areashape="rect" id="node19" href="#matplotlib.dates.YearLocator" title="Make ticks on a given day of each year that is a multiple of base." alt="" coords="508,257,590,279"/>
<areashape="rect" id="node5" href="units_api.html#matplotlib.units.ConversionInterface" title="The minimal interface for a converter to take custom instances (or" alt="" coords="5,89,133,111"/>
<areashape="rect" id="node6" title="Converter for datetime.date and datetime.datetime data," alt="" coords="174,89,273,111"/>
<areashape="rect" id="node8" href="ticker_api.html#matplotlib.ticker.Locator" title="Determine the tick locations;" alt="" coords="193,174,254,195"/>
<areashape="rect" id="node9" href="#matplotlib.dates.DayLocator" title="Make ticks on occurances of each day of the month.  For example," alt="" coords="669,66,750,88"/>
<areashape="rect" id="node12" href="#matplotlib.dates.HourLocator" title="Make ticks on occurances of each hour." alt="" coords="666,109,753,130"/>
<areashape="rect" id="node15" href="#matplotlib.dates.MinuteLocator" title="Make ticks on occurances of each minute." alt="" coords="661,151,758,173"/>
<areashape="rect" id="node16" href="#matplotlib.dates.MonthLocator" title="Make ticks on occurances of each month month, e.g., 1, 3, 12." alt="" coords="662,193,757,215"/>
<areashape="rect" id="node17" href="#matplotlib.dates.SecondLocator" title="Make ticks on occurances of each second." alt="" coords="658,235,760,257"/>
<areashape="rect" id="node18" href="#matplotlib.dates.WeekdayLocator" title="Make ticks on occurances of each weekday." alt="" coords="655,278,763,299"/>
<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"><ttclass="xref py py-mod docutils literal"><spanclass="pre">matplotlib.ticker</span></tt></a> for general information on tick locators
and formatters. These are described below.</p>
<p>All the matplotlib date converters, tickers and formatters are
timezone aware, and the default timezone is given by the timezone
parameter in your <ttclass="file docutils literal"><spanclass="pre">matplotlibrc</span></tt> file. If you leave out a
<ttclass="xref py py-class docutils literal"><spanclass="pre">tz</span></tt> timezone instance, the default from your rc file will be
assumed. If you want to use a custom time zone, pass a
<ttclass="xref py py-class docutils literal"><spanclass="pre">pytz.timezone</span></tt> instance with the tz keyword argument to
<aclass="reference internal" href="#matplotlib.dates.num2date" title="matplotlib.dates.num2date"><ttclass="xref py py-func docutils literal"><spanclass="pre">num2date()</span></tt></a>, <ttclass="xref py py-func docutils literal"><spanclass="pre">plot_date()</span></tt>, and any custom date tickers or
locators you create. See <aclass="reference external" href="http://pytz.sourceforge.net">pytz</a> for
information on <ttclass="xref py py-mod docutils literal"><spanclass="pre">pytz</span></tt> and timezone handling.</p>
<li><aclass="reference internal" href="#matplotlib.dates.DayLocator" title="matplotlib.dates.DayLocator"><ttclass="xref py py-class docutils literal"><spanclass="pre">DayLocator</span></tt></a>: locate specifed days of the month</li>
<li><aclass="reference internal" href="#matplotlib.dates.WeekdayLocator" title="matplotlib.dates.WeekdayLocator"><ttclass="xref py py-class docutils literal"><spanclass="pre">WeekdayLocator</span></tt></a>: Locate days of the week, e.g., MO, TU</li>
<li><aclass="reference internal" href="#matplotlib.dates.YearLocator" title="matplotlib.dates.YearLocator"><ttclass="xref py py-class docutils literal"><spanclass="pre">YearLocator</span></tt></a>: locate years that are multiples of base</li>
<li><aclass="reference internal" href="#matplotlib.dates.RRuleLocator" title="matplotlib.dates.RRuleLocator"><ttclass="xref py py-class docutils literal"><spanclass="pre">RRuleLocator</span></tt></a>: locate using a
<ttclass="xref py py-class docutils literal"><spanclass="pre">matplotlib.dates.rrulewrapper</span></tt>. The
<ttclass="xref py py-class docutils literal"><spanclass="pre">rrulewrapper</span></tt> is a simple wrapper around a
<ttclass="xref py py-class docutils literal"><spanclass="pre">dateutil.rrule</span></tt> (<aclass="reference external" href="http://labix.org/python-dateutil">dateutil</a>) which allow almost
arbitrary date tick specifications. See <aclass="reference external" href="../examples/pylab_examples/date_demo_rrule.html">rrule example</a>.</li>
<li><aclass="reference internal" href="#matplotlib.dates.AutoDateLocator" title="matplotlib.dates.AutoDateLocator"><ttclass="xref py py-class docutils literal"><spanclass="pre">AutoDateLocator</span></tt></a>: On autoscale, this class picks the best
<ttclass="xref py py-class docutils literal"><spanclass="pre">MultipleDateLocator</span></tt> to set the view limits and the tick
locations.</li>
</ul>
</div></blockquote>
</div>
<divclass="section" id="date-formatters">
<h3>Date formatters<aclass="headerlink" href="#date-formatters" title="Permalink to this headline">¶</a></h3>
<p>Here all all the date formatters:</p>
<blockquote>
<div><ulclass="simple">
<li><aclass="reference internal" href="#matplotlib.dates.AutoDateFormatter" title="matplotlib.dates.AutoDateFormatter"><ttclass="xref py py-class docutils literal"><spanclass="pre">AutoDateFormatter</span></tt></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"><ttclass="xref py py-class docutils literal"><spanclass="pre">AutoDateLocator</span></tt></a>.</li>
<li><aclass="reference internal" href="#matplotlib.dates.DateFormatter" title="matplotlib.dates.DateFormatter"><ttclass="xref py py-class docutils literal"><spanclass="pre">DateFormatter</span></tt></a>: use <ttclass="xref py py-func docutils literal"><spanclass="pre">strftime()</span></tt> format strings</li>
<li><aclass="reference internal" href="#matplotlib.dates.IndexDateFormatter" title="matplotlib.dates.IndexDateFormatter"><ttclass="xref py py-class docutils literal"><spanclass="pre">IndexDateFormatter</span></tt></a>: date plots with implicit <em>x</em>
indexing.</li>
</ul>
</div></blockquote>
<dlclass="function">
<dtid="matplotlib.dates.date2num">
<ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">date2num</tt><big>(</big><em>d</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.date2num" title="Permalink to this definition">¶</a></dt>
<dd><p><em>d</em> is either a <ttclass="xref py py-class docutils literal"><spanclass="pre">datetime</span></tt> instance or a sequence of datetimes.</p>
<p>Return value is a floating point number (or sequence of floats)
which gives the number of days (fraction part represents hours,
minutes, seconds) since 0001-01-01 00:00:00 UTC, <em>plus</em><em>one</em>.
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="function">
<dtid="matplotlib.dates.num2date">
<ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">num2date</tt><big>(</big><em>x</em>, <em>tz=None</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.num2date" title="Permalink to this definition">¶</a></dt>
<dd><p><em>x</em> is a float value which gives the number of days
(fraction part represents hours, minutes, seconds) since
0001-01-01 00:00:00 UTC <em>plus</em><em>one</em>.
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>
<p>Return value is a <ttclass="xref py py-class docutils literal"><spanclass="pre">datetime</span></tt> instance in timezone <em>tz</em> (default to
rcparams TZ value).</p>
<p>If <em>x</em> is a sequence, a sequence of <ttclass="xref py py-class docutils literal"><spanclass="pre">datetime</span></tt> objects will
be returned.</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.dates.drange">
<ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">drange</tt><big>(</big><em>dstart</em>, <em>dend</em>, <em>delta</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.drange" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a date range as float Gregorian ordinals. <em>dstart</em> and
<em>dend</em> are <ttclass="xref py py-class docutils literal"><spanclass="pre">datetime</span></tt> instances. <em>delta</em> is a
<ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">epoch2num</tt><big>(</big><em>e</em><big>)</big><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="function">
<dtid="matplotlib.dates.num2epoch">
<ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">num2epoch</tt><big>(</big><em>d</em><big>)</big><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="function">
<dtid="matplotlib.dates.mx2num">
<ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">mx2num</tt><big>(</big><em>mxdates</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.mx2num" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">DateFormatter</tt><big>(</big><em>fmt</em>, <em>tz=None</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.DateFormatter" title="Permalink to this definition">¶</a></dt>
<p>Tick location is seconds since the epoch. Use a <aclass="reference internal" href="#matplotlib.dates.DateFormatter.strftime" title="matplotlib.dates.DateFormatter.strftime"><ttclass="xref py py-func docutils literal"><spanclass="pre">strftime()</span></tt></a>
for years greater than 1900. Thanks to Andrew Dalke, Dalke
Scientific Software who contributed the <aclass="reference internal" href="#matplotlib.dates.DateFormatter.strftime" title="matplotlib.dates.DateFormatter.strftime"><ttclass="xref py py-func docutils literal"><spanclass="pre">strftime()</span></tt></a> code
below to include dates earlier than this year.</p>
<p><em>fmt</em> is an <aclass="reference internal" href="#matplotlib.dates.DateFormatter.strftime" title="matplotlib.dates.DateFormatter.strftime"><ttclass="xref py py-func docutils literal"><spanclass="pre">strftime()</span></tt></a> format string; <em>tz</em> is the
<ttclass="descname">illegal_s</tt><emclass="property"> = <_sre.SRE_Pattern object at 0x7f67af032030></em><aclass="headerlink" href="#matplotlib.dates.DateFormatter.illegal_s" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">set_tzinfo</tt><big>(</big><em>tz</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.DateFormatter.set_tzinfo" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.dates.DateFormatter.strftime">
<ttclass="descname">strftime</tt><big>(</big><em>dt</em>, <em>fmt</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.DateFormatter.strftime" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.dates.IndexDateFormatter">
<emclass="property">class </em><ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">IndexDateFormatter</tt><big>(</big><em>t</em>, <em>fmt</em>, <em>tz=None</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.IndexDateFormatter" title="Permalink to this definition">¶</a></dt>
<p>Use with <aclass="reference internal" href="ticker_api.html#matplotlib.ticker.IndexLocator" title="matplotlib.ticker.IndexLocator"><ttclass="xref py py-class docutils literal"><spanclass="pre">IndexLocator</span></tt></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
<ttclass="xref py py-func docutils literal"><spanclass="pre">strftime()</span></tt> format string.</p>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.dates.AutoDateFormatter">
<emclass="property">class </em><ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">AutoDateFormatter</tt><big>(</big><em>locator</em>, <em>tz=None</em>, <em>defaultfmt=u'%Y-%m-%d'</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.AutoDateFormatter" title="Permalink to this definition">¶</a></dt>
<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"><ttclass="xref py py-class docutils literal"><spanclass="pre">AutoDateLocator</span></tt></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="s">'%M:%S'</span><spanclass="c"># 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"><ttclass="xref py py-class docutils literal"><spanclass="pre">FuncFormatter</span></tt></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
<p>Autoformat the date labels. The default format is the one to use
if none of the values in <ttclass="docutils literal"><spanclass="pre">self.scaled</span></tt> are greater than the unit
returned by <ttclass="docutils literal"><spanclass="pre">locator._get_unit()</span></tt>.</p>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.dates.DateLocator">
<emclass="property">class </em><ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">DateLocator</tt><big>(</big><em>tz=None</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.DateLocator" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">datalim_to_dt</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.dates.DateLocator.datalim_to_dt" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="attribute">
<dtid="matplotlib.dates.DateLocator.hms0d">
<ttclass="descname">hms0d</tt><emclass="property"> = {u'byminute': 0, u'byhour': 0, u'bysecond': 0}</em><aclass="headerlink" href="#matplotlib.dates.DateLocator.hms0d" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.dates.DateLocator.nonsingular">
<ttclass="descname">nonsingular</tt><big>(</big><em>vmin</em>, <em>vmax</em><big>)</big><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="method">
<dtid="matplotlib.dates.DateLocator.set_tzinfo">
<ttclass="descname">set_tzinfo</tt><big>(</big><em>tz</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.DateLocator.set_tzinfo" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">viewlim_to_dt</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.dates.DateLocator.viewlim_to_dt" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.dates.RRuleLocator">
<emclass="property">class </em><ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">RRuleLocator</tt><big>(</big><em>o</em>, <em>tz=None</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.RRuleLocator" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">autoscale</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.dates.RRuleLocator.autoscale" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the view limits to include the data range.</p>
<emclass="property">static </em><ttclass="descname">get_unit_generic</tt><big>(</big><em>freq</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.RRuleLocator.get_unit_generic" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.dates.AutoDateLocator">
<emclass="property">class </em><ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">AutoDateLocator</tt><big>(</big><em>tz=None</em>, <em>minticks=5</em>, <em>maxticks=None</em>, <em>interval_multiples=False</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.AutoDateLocator" title="Permalink to this definition">¶</a></dt>
<aclass="reference internal" href="#matplotlib.dates.DateLocator" title="matplotlib.dates.DateLocator"><ttclass="xref py py-class docutils literal"><spanclass="pre">DateLocator</span></tt></a> to set the view limits and the tick
locations.</p>
<p><em>minticks</em> is the minimum number of ticks desired, which is used to
select the type of ticking (yearly, monthly, etc.).</p>
<p><em>maxticks</em> is the maximum number of ticks desired, which controls
any interval between ticks (ticking every other, every 3, etc.).
For really 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"><ttclass="xref py py-class docutils literal"><spanclass="pre">AutoDateFormatter</span></tt></a>. Any frequency not specified in this
dictionary is given a default value.</p>
<p><em>tz</em> is a <ttclass="xref py py-class docutils literal"><spanclass="pre">tzinfo</span></tt> instance.</p>
<p><em>interval_multiples</em> is a boolean that indicates whether ticks
should be chosen to be multiple of the interval. This will lock
ticks to ‘nicer’ locations. For example, this will force the
ticks to be at hours 0,6,12,18 when hourly ticking is done at
6 hour intervals.</p>
<p>The AutoDateLocator has an interval dictionary that maps the
frequency of the tick (a constant from dateutil.rrule) and a
multiple allowed for that ticking. The default looks like this:</p>
<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="c"># only show every 3 hours</span>
<ttclass="descname">autoscale</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.dates.AutoDateLocator.autoscale" title="Permalink to this definition">¶</a></dt>
<dd><p>Try to choose the view limits intelligently.</p>
<ttclass="descname">get_locator</tt><big>(</big><em>dmin</em>, <em>dmax</em><big>)</big><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>
<ttclass="descname">nonsingular</tt><big>(</big><em>vmin</em>, <em>vmax</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.AutoDateLocator.nonsingular" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.dates.AutoDateLocator.refresh">
<ttclass="descname">refresh</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.dates.AutoDateLocator.refresh" title="Permalink to this definition">¶</a></dt>
<dd><p>Refresh internal information based on current limits.</p>
<ttclass="descname">set_axis</tt><big>(</big><em>axis</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.AutoDateLocator.set_axis" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.dates.YearLocator">
<emclass="property">class </em><ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">YearLocator</tt><big>(</big><em>base=1</em>, <em>month=1</em>, <em>day=1</em>, <em>tz=None</em><big>)</big><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="method">
<dtid="matplotlib.dates.YearLocator.autoscale">
<ttclass="descname">autoscale</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.dates.YearLocator.autoscale" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the view limits to include the data range.</p>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.dates.MonthLocator">
<emclass="property">class </em><ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">MonthLocator</tt><big>(</big><em>bymonth=None</em>, <em>bymonthday=1</em>, <em>interval=1</em>, <em>tz=None</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.MonthLocator" title="Permalink to this definition">¶</a></dt>
<p>Make ticks on occurances of each month 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 <ttclass="docutils literal"><spanclass="pre">range(1,13)</span></tt>, i.e. every month.</p>
<p><em>interval</em> is the interval between each iteration. For
example, if <ttclass="docutils literal"><spanclass="pre">interval=2</span></tt>, mark every second occurance.</p>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.dates.WeekdayLocator">
<emclass="property">class </em><ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">WeekdayLocator</tt><big>(</big><em>byweekday=1</em>, <em>interval=1</em>, <em>tz=None</em><big>)</big><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 <ttclass="xref py py-mod docutils literal"><spanclass="pre">dateutil.rrule</span></tt>, which have been
imported into the <aclass="reference internal" href="#module-matplotlib.dates" title="matplotlib.dates"><ttclass="xref py py-mod docutils literal"><spanclass="pre">matplotlib.dates</span></tt></a> namespace.</p>
<p><em>interval</em> specifies the number of weeks to skip. For example,
<ttclass="docutils literal"><spanclass="pre">interval=2</span></tt> plots every second week.</p>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.dates.DayLocator">
<emclass="property">class </em><ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">DayLocator</tt><big>(</big><em>bymonthday=None</em>, <em>interval=1</em>, <em>tz=None</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.DayLocator" title="Permalink to this definition">¶</a></dt>
<p>Make ticks on occurances 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: <ttclass="docutils literal"><spanclass="pre">bymonthday=range(1,32)</span></tt></p>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.dates.HourLocator">
<emclass="property">class </em><ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">HourLocator</tt><big>(</big><em>byhour=None</em>, <em>interval=1</em>, <em>tz=None</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.HourLocator" title="Permalink to this definition">¶</a></dt>
<p>Mark every hour in <em>byhour</em>; <em>byhour</em> can be an int or sequence.
Default is to tick every hour: <ttclass="docutils literal"><spanclass="pre">byhour=range(24)</span></tt></p>
<p><em>interval</em> is the interval between each iteration. For
example, if <ttclass="docutils literal"><spanclass="pre">interval=2</span></tt>, mark every second occurrence.</p>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.dates.MinuteLocator">
<emclass="property">class </em><ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">MinuteLocator</tt><big>(</big><em>byminute=None</em>, <em>interval=1</em>, <em>tz=None</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.MinuteLocator" title="Permalink to this definition">¶</a></dt>
<p>Mark every minute in <em>byminute</em>; <em>byminute</em> can be an int or
sequence. Default is to tick every minute: <ttclass="docutils literal"><spanclass="pre">byminute=range(60)</span></tt></p>
<p><em>interval</em> is the interval between each iteration. For
example, if <ttclass="docutils literal"><spanclass="pre">interval=2</span></tt>, mark every second occurrence.</p>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.dates.SecondLocator">
<emclass="property">class </em><ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">SecondLocator</tt><big>(</big><em>bysecond=None</em>, <em>interval=1</em>, <em>tz=None</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.SecondLocator" title="Permalink to this definition">¶</a></dt>
<p>Mark every second in <em>bysecond</em>; <em>bysecond</em> can be an int or
sequence. Default is to tick every second: <ttclass="docutils literal"><spanclass="pre">bysecond</span><spanclass="pre">=</span><spanclass="pre">range(60)</span></tt></p>
<p><em>interval</em> is the interval between each iteration. For
example, if <ttclass="docutils literal"><spanclass="pre">interval=2</span></tt>, mark every second occurrence.</p>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.dates.MicrosecondLocator">
<emclass="property">class </em><ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">MicrosecondLocator</tt><big>(</big><em>interval=1</em>, <em>tz=None</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.MicrosecondLocator" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">set_axis</tt><big>(</big><em>axis</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.MicrosecondLocator.set_axis" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">set_data_interval</tt><big>(</big><em>vmin</em>, <em>vmax</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.MicrosecondLocator.set_data_interval" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">set_view_interval</tt><big>(</big><em>vmin</em>, <em>vmax</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.MicrosecondLocator.set_view_interval" title="Permalink to this definition">¶</a></dt>
Absolute information (argument is singular); adding or subtracting a
relativedelta with absolute information does not perform an aritmetic
operation, but rather REPLACES the corresponding value in the
original datetime with the value(s) in relativedelta.
years, months, weeks, days, hours, minutes, seconds, microseconds:
Relative information, may be negative (argument is plural); adding
or subtracting a relativedelta with relative information performs
the corresponding aritmetic operation on the original datetime value
with the information in the relativedelta.
weekday:
One of the weekday instances (MO, TU, etc). These instances may
receive a parameter N, specifying the Nth weekday, which could
be positive or negative (like MO(+1) or MO(-2). Not specifying
it is the same as specifying +1. You can also use an integer,
where 0=MO.
leapdays:
Will add given days to the date found, if year is a leap
year, and the date found is post 28 of february.
yearday, nlyearday:
Set the yearday or the non-leap year day (jump leap days).
These are converted to day/month/leapdays information.
</pre></div>
</div>
<p>Here is the behavior of operations with relativedelta:</p>
<olclass="arabic simple">
<li>Calculate the absolute year, using the ‘year’ argument, or the
original datetime year, if the argument is not present.</li>
<li>Add the relative ‘years’ argument to the absolute year.</li>
<li>Do steps 1 and 2 for month/months.</li>
<li>Calculate the absolute day, using the ‘day’ argument, or the
original datetime day, if the argument is not present. Then,
subtract from the day until it fits in the year and month
found after their operations.</li>
<li>Add the relative ‘days’ argument to the absolute day. Notice
that the ‘weeks’ argument is multiplied by 7 and added to
‘days’.</li>
<li>Do steps 1 and 2 for hour/hours, minute/minutes, second/seconds,
microsecond/microseconds.</li>
<li>If the ‘weekday’ argument is present, calculate the weekday,
with the given (wday, nth) tuple. wday is the index of the
weekday (0-6, 0=Mon), and nth is the number of weeks to add
forward or backward, depending on its signal. Notice that if
the calculated date is already Monday, for example, using
(0, 1) or (0, -1) won’t change the day.</li>
</ol>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.dates.seconds">
<ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">seconds</tt><big>(</big><em>s</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.seconds" title="Permalink to this definition">¶</a></dt>
<dd><p>Return seconds as days.</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.dates.minutes">
<ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">minutes</tt><big>(</big><em>m</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.minutes" title="Permalink to this definition">¶</a></dt>
<dd><p>Return minutes as days.</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.dates.hours">
<ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">hours</tt><big>(</big><em>h</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.hours" title="Permalink to this definition">¶</a></dt>
<dd><p>Return hours as days.</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.dates.weeks">
<ttclass="descclassname">matplotlib.dates.</tt><ttclass="descname">weeks</tt><big>(</big><em>w</em><big>)</big><aclass="headerlink" href="#matplotlib.dates.weeks" title="Permalink to this definition">¶</a></dt>