Files
intellecton/venv/lib/python3.12/site-packages/matplotlib/__pycache__/dates.cpython-312.pyc
T

876 lines
74 KiB
Plaintext
Raw Normal View History

Ë
†Rjãó^—dZddlZddlZddlZddlZddlmZmZmZm Z m
Z
m Z m Z m
Z
mZmZmZmZmZmZmZddlmZddlZddlZddlZddlZddlmZmZm Z m!Z!dZ"ejFe$«Z%ejLjNZ(dCd„Z)e*ejdd d «jW««Z,ed zZ-d
Z.d Z/d Z0d Z1d
Z2dZ3dZ4e/e.zZ5e0e/zZ6e6e.zZ7e7e2zZ8de7zZ9eee e
e e e
f\Z:Z;Z<Z=Z>Z?Z@e:e;e<e=e>e?e@fZAdaBd„ZCd„ZDd„ZEd„ZFdCd„ZGej�eGd¬«ZIej�ej”j–«ZLdCd„ZMd„ZNdCd„ZOej�d„d¬«ZPd„ZQd„ZRd„ZSGd„d e j¨«ZUGd!„d"e j¨«ZVGd#„d$e j¨«ZWGd%„d&«ZXGd'„d(e j²«ZZGd)„d*eZ«Z[Gd+„d,eZ«Z\Gd-„d.e[«Z]Gd/„d0e[«Z^Gd1„d2e[«Z_Gd3„d4e[«Z`Gd5„d6e[«ZaGd7„d8e[«ZbGd9„d:e[«ZcGd;„d<eZ«ZdGd=„d>e!jÊ«ZfGd?„d@ef«ZgGdA„dB«Zheh«xe!jÒejÔ<xe!jÒejÖ<e!jÒej<y)Da‰
Matplotlib provides sophisticated date plotting capabilities, standing on the
shoulders of python :mod:`datetime` and the add-on module dateutil_.
By default, Matplotlib uses the units machinery described in
`~matplotlib.units` to convert `datetime.datetime`, and `numpy.datetime64`
objects when plotted on an x- or y-axis. The user does not
need to do anything for dates to be formatted, but dates often have strict
formatting needs, so this module provides many tick locators and formatters.
A basic example using `numpy.datetime64` is::
import numpy as np
times = np.arange(np.datetime64('2001-01-02'),
np.datetime64('2002-02-03'), np.timedelta64(75, 'm'))
y = np.random.randn(len(times))
fig, ax = plt.subplots()
ax.plot(times, y)
.. seealso::
- :doc:`/gallery/text_labels_and_annotations/date`
- :doc:`/gallery/ticks/date_concise_formatter`
- :doc:`/gallery/ticks/date_demo_convert`
.. _date-format:
Matplotlib date format
----------------------
Matplotlib represents dates using floating point numbers specifying the number
of days since a default epoch of 1970-01-01 UTC; for example,
1970-01-01, 06:00 is the floating point number 0.25. The formatters and
locators require the use of `datetime.datetime` objects, so only dates between
year 0001 and 9999 can be represented. Microsecond precision
is achievable for (approximately) 70 years on either side of the epoch, and
20 microseconds for the rest of the allowable range of dates (year 0001 to
9999). The epoch can be changed at import time via `.dates.set_epoch` or
:rc:`date.epoch` to other dates if necessary; see
:doc:`/gallery/ticks/date_precision_and_epochs` for a discussion.
.. note::
Before Matplotlib 3.3, the epoch was 0000-12-31 which lost modern
microsecond precision and also made the default axis limit of 0 an invalid
datetime. In 3.3 the epoch was changed as above. To convert old
ordinal floats to the new epoch, users can do::
new_ordinal = old_ordinal + mdates.date2num(np.datetime64('0000-12-31'))
There are a number of helper functions to convert between :mod:`datetime`
objects and Matplotlib dates:
.. currentmodule:: matplotlib.dates
.. autosummary::
:nosignatures:
datestr2num
date2num
num2date
num2timedelta
drange
set_epoch
get_epoch
.. note::
Like Python's `datetime.datetime`, Matplotlib uses the Gregorian calendar
for all conversions between dates and floating point numbers. This practice
is not universal, and calendar differences can cause confusing
differences between what Python and Matplotlib give as the number of days
since 0001-01-01 and what other software and databases yield. For
example, the US Naval Observatory uses a calendar that switches
from Julian to Gregorian in October, 1582. Hence, using their
calculator, the number of days between 0001-01-01 and 2006-04-01 is
732403, whereas using the Gregorian calendar via the datetime
module we find::
In [1]: date(2006, 4, 1).toordinal() - date(1, 1, 1).toordinal()
Out[1]: 732401
All the Matplotlib date converters, locators and formatters are timezone aware.
If no explicit timezone is provided, :rc:`timezone` is assumed, provided as a
string. If you want to use a different timezone, pass the *tz* keyword
argument of `num2date` to any date tick locators or formatters you create. This
can be either a `datetime.tzinfo` instance or a string with the timezone name
that can be parsed by `~dateutil.tz.gettz`.
A wide range of specific and general purpose date tick locators and
formatters are provided in this module. See
:mod:`matplotlib.ticker` for general information on tick locators
and formatters. These are described below.
The dateutil_ module provides additional code to handle date ticking, making it
easy to place ticks on any kinds of dates. See examples below.
.. _dateutil: https://dateutil.readthedocs.io
.. _date-locators:
Date tick locators
------------------
Most of the date tick locators can locate single or multiple ticks. For example::
# import constants for the days of the week
from matplotlib.dates import MO, TU, WE, TH, FR, SA, SU
# tick on Mondays every week
loc = WeekdayLocator(byweekday=MO, tz=tz)
# tick on Mondays and Saturdays
loc = WeekdayLocator(byweekday=(MO, SA))
In addition, most of the constructors take an interval argument::
# tick on Mondays every second week
loc = WeekdayLocator(byweekday=MO, interval=2)
The rrule locator allows completely general date ticking::
# tick every 5th easter
rule = rrulewrapper(YEARLY, byeaster=1, interval=5)
loc = RRuleLocator(rule)
The available date tick locators are:
* `MicrosecondLocator`: Locate microseconds.
* `SecondLocator`: Locate seconds.
* `MinuteLocator`: Locate minutes.
* `HourLocator`: Locate hours.
* `DayLocator`: Locate specified days of the month.
* `WeekdayLocator`: Locate days of the week, e.g., MO, TU.
* `MonthLocator`: Locate months, e.g., 7 for July.
* `YearLocator`: Locate years that are multiples of base.
* `RRuleLocator`: Locate using a `rrulewrapper`.
`rrulewrapper` is a simple wrapper around dateutil_'s `dateutil.rrule`
which allow almost arbitrary date tick specifications.
See :doc:`rrule example </gallery/ticks/date_demo_rrule>`.
* `AutoDateLocator`: On autoscale, this class picks the best `DateLocator`
(e.g., `RRuleLocator`) to set the view limits and the tick locations. If
called with ``interval_multiples=True`` it will make ticks line up with
sensible multiples of the tick intervals. For example, if the interval is
4 hours, it will pick hours 0, 4, 8, etc. as ticks. This behaviour is not
guaranteed by default.
.. _date-formatters:
Date formatters
---------------
The available date formatters are:
* `AutoDateFormatter`: attempts to figure out the best format to use. This is
most useful when used with the `AutoDateLocator`.
* `ConciseDateFormatter`: 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 `AutoDateLocator`.
* `DateFormatter`: use `~datetime.datetime.strftime` format strings.
éN)ÚrruleÚMOÚTUÚWEÚTHÚFRÚSAÚSUÚYEARLYÚMONTHLYÚWEEKLYÚDAILYÚHOURLYÚMINUTELYÚSECONDLY)Ú
relativedelta)Ú_apiÚcbookÚtickerÚunits))Ú datestr2numÚdate2numÚnum2dateÚ
num2timedeltaÚdrangeÚ set_epochÚ get_epochÚ
DateFormatterÚConciseDateFormatterÚAutoDateFormatterÚ DateLocatorÚ RRuleLocatorÚAutoDateLocatorÚ YearLocatorÚ MonthLocatorÚWeekdayLocatorÚ
DayLocatorÚ HourLocatorÚ
MinuteLocatorÚ
SecondLocatorÚMicrosecondLocatorrrrrrrr r
r r r
rrrrÚ
MICROSECONDLYrÚ
DateConverterÚConciseDateConverterÚ rrulewrappercó—tj|d«}|dk(rtSt|t«r1t
j j|«}|€t|›d�«‚|St|tj«r|Std|›d�«‚)zœ
Generate `~datetime.tzinfo` from a string or return `~datetime.tzinfo`.
If None, retrieve the preferred timezone from the rcParams dictionary.
ÚtimezoneÚUTCz8 is not a valid timezone as parsed by dateutil.tz.gettz.z*tz must be string or tzinfo subclass, not ú.) ÚmplÚ
_val_or_rcr2Ú
isinstanceÚstrÚdateutilÚtzÚgettzÚ
ValueErrorÚdatetimeÚtzinfoÚ TypeError)r9r=s úS/home/antigravity/intellecton/venv/lib/python3.12/site-packages/matplotlib/dates.pyÚ _get_tzinfor@Ðs‹€ô
�‰˜˜JÓ '€BØ ˆU‚{܈
Ü�"”cÔÜ—‘×"Ñ" 2Ó&ˆØ ˆ>Ü ˜tð$3ð3ó4ð
4àˆ
Ü�"”h—o‘oÔ&؈ Ü
Ð@ÀÀÀaÐHÓ
IÐIóé²ég8@gN@g(@g@g>@gÐv@瀄.Acó—day)zj
Reset the Matplotlib date epoch so it can be set again.
Only for use in tests and examples.
N)Ú_epoch©rAr?Ú_reset_epoch_test_examplerHs €ð�FrAcó*—t� td«‚|ay)aÎ
Set the epoch (origin for dates) for datetime calculations.
The default epoch is :rc:`date.epoch`.
If microsecond accuracy is desired, the date being plotted needs to be
within approximately 70 years of the epoch. Matplotlib internally
represents dates as days since the epoch, so floating point dynamic
range needs to be within a factor of 2^52.
`~.dates.set_epoch` must be called before any dates are converted
(i.e. near the import section) or a RuntimeError will be raised.
See also :doc:`/gallery/ticks/date_precision_and_epochs`.
Parameters
----------
epoch : str
valid UTC date parsable by `numpy.datetime64` (do not include
timezone).
Nz.set_epoch must be called before dates plotted.)rFÚ RuntimeError)Úepochs r?rr
s€ô0ÐÜÐKÓLÐLØ
�FrAcóB—tjtd«atS)z‘
Get the epoch used by `.dates`.
Returns
-------
epoch : str
String for the epoch (parsable by `numpy.datetime64`).
z
date.epoch)r4r5rFrGrAr?rr's€ô�^‰^œF LÓ
1€FÜ €MrAcóú—|jd«}||z
jd«}tjt«d«}||z
jtj«}||jtj«dz z
}|t
z }tjd«jtj «}|jtj «}tj|||k(<|S)a<
Convert `numpy.datetime64` or an `numpy.ndarray` of those types to
Gregorian date as UTC float relative to the epoch (see `.get_epoch`).
Roundoff is float64 precision. Practically: microseconds for dates
between 290301 BC, 294241 AD, milliseconds for larger dates
(see `numpy.datetime64`).
z
datetime64[s]ztimedelta64[ns]ÚsgeÍÍAÚNaT)ÚastypeÚnpÚ
datetime64rÚfloat64Ú SEC_PER_DAYÚint64Únan)ÚdÚdsecondsÚextraÚt0ÚdtÚNaT_intÚd_ints r?Ú_dt64_to_ordinalfr^6s¾€ð�x‰x˜Ó(€HØ
�‰\× !Ñ !Ð"3Ó 4€EÜ �‰”y“{ CÓ (€BØ
�R‰-× Ñ ¤§
¡
Ó +€B؈%�,‰,”r—z‘zÓ
" UÑ
*Ñ*€BØ ŒkÑ €Bä�m‰m˜EÓ"×)Ñ)¬"¯(©(Ó3€GØ
�H‰H”R—X‘XÓ €EÜŸ6™6€B€u�ÑÑØ
€IrAc óî—t|«}tjt««tjt tj |tz««d«z}|tjd«ks|tjd«k\rtd|›d|›dt«›d�«‚|j«}|jtjjd«¬ «}|j|«}tj|«d
kDr]t
|j d z «d z}|d k(r+|jd
¬«t#j$d¬«z}|S|j|¬«}|S)ax
Convert Gregorian float of the date, preserving hours, minutes,
seconds and microseconds. Return value is a `.datetime`.
The input date *x* is a float in ordinal days at UTC, and the output will
be the specified `.datetime` object corresponding to that time in
timezone *tz*, or if *tz* is ``None``, in the timezone specified in
:rc:`timezone`.
Úusz
0001-01-01z 10000-01-01z
Date ordinal z
converts to z (using epoch z;), but Matplotlib dates must be between year 0001 and 9999.r2©r=éÎcéé@Br)Ú microsecondrC)Úseconds)r@rQrRrÚ timedelta64ÚintÚroundÚMUSECONDS_PER_DAYr;ÚtolistÚreplacer8r9r:Ú
astimezoneÚabsrer<Ú timedelta)Úxr9r[Úmss r?Ú_from_ordinalfrrNs@€ô
�R‹€Bä
�-‰-œ › Ó
$Ü
�.‰.œœRŸX™X aÔ*;Ñ&;Ó<Ó=¸tÓ
Dñ E€Bà ŒB�M‰M˜,Ó 'Ò'¨2´·±¸}Ó1MÒ+Mܘ=¨¨¨=¸¸ð="Ü"+£+ ð/8ð8ó9ð 9ð
�‰‹€Bð
�‰œ8Ÿ;™;×,Ñ,¨UÓ3ˆÓ 4€Bà �‰�rÓ €Bä ‡v�vˆaƒy�8Òô�2—>‘> BÑ&Ó
'¨"Ñ
,ˆØ
�Š=Ø—‘¨�Ó*¬X×-?Ñ-?ÈÔ-JÑJˆBð €I𗑨�Ó+ˆBà
€IrAÚO)Úotypesc óŽ—t|t«r,tjj ||¬«}t |«S|�L|D�cgc],}t tjj ||¬««‘Œ.}}t
j|«St
j|«}|js|St t|««Scc}w)a
Convert a date string to a datenum using `dateutil.parser.parse`.
Parameters
----------
d : str or sequence of str
The dates to convert.
default : datetime.datetime, optional
The default date to use when fields are missing in *d*.
©Údefault)
r6r7r8ÚparserÚparserrQÚasarrayÚsizeÚ$_dateutil_parser_parse_np_vectorized)rWrwr[rNs r?rr{sª€ô�!”SÔÜ
�_‰_×
"Ñ
" 1¨gÐ
"Ó
6ˆÜ˜‹|Ðà Ð àöØôœ(Ÿ/™/×/Ñ/°¸7Ð/ÓCÕDðˆAðä—:‘:˜a“=Ð Ü �J‰J�q‹MˆØ�vŠv؈HÜÔ<¸QÓ?Ó@Ð@ùò
sÁ1CcóΗtj|«}tj|«}|s|g}tjj |«}tjj
|«}tj|«}tj|jtj«sx|js|St|ddd«}|�G|D�cgc]'}|jt«jd¬«‘Œ)}}tj|«}|j!d«}|r!tjj#||¬«n|}t%|«}|r|S|dScc}w)ac
Convert datetime objects to Matplotlib dates.
Parameters
----------
d : `datetime.datetime` or `numpy.datetime64` or sequences of these
Returns
-------
float or sequence of floats
Number of days since the epoch. See `.get_epoch` for the
epoch, which can be changed by :rc:`date.epoch` or `.set_epoch`. If
the epoch is "1970-01-01T00:00:00" (default) then noon Jan 1 1970
("1970-01-01T12:00:00") returns 0.5.
Notes
-----
The Gregorian calendar is assumed; this is not universal practice.
For details see the module docstring.
rr=Nrazdatetime64[us])Úmask)rÚ_unpack_to_numpyrQÚiterableÚmaÚ is_maskedÚgetmaskrzÚ
issubdtypeÚdtyperRr{Úgetattrrmr2rlrPÚ masked_arrayr^)rWr€Úmaskedr~Útzir[s r?rr•s€ô, ×јqÓ!€Aô�{‰{˜1‹~€HÙ Ø
ˆCˆä
�U‰U�_‰_˜QÓ
€FÜ
�5‰5�=‰=˜Ó €DÜ
�
‰
�1‹
€Aô �=‰=˜Ÿ™¤"§-¡-Ô 0à�vŠvàˆHÜ�a˜‘d˜H dÓ+ˆØ ˆ?àCDÖE¸R�—‘œsÓ#×+Ñ+°4Ð+Õ8ÐEˆAÐEÜ—
‘
˜1“
ˆAØ
�H‰HÐ%Ó &ˆá,2Œ�‰×ј1 4ÐÔ(¸€Aܘ!Ó€Aáˆ1Ð"˜a ™dÐ"ùòFsÃ,E"cóL—t|«}t||«j«S)a=
Convert Matplotlib dates to `~datetime.datetime` objects.
Parameters
----------
x : float or sequence of floats
Number of days (fraction part represents hours, minutes, seconds)
since the epoch. See `.get_epoch` for the
epoch, which can be changed by :rc:`date.epoch` or `.set_epoch`.
tz : str or `~datetime.tzinfo`, default: :rc:`timezone`
Timezone of *x*. If a string, *tz* is passed to `dateutil.tz`.
Returns
-------
`~datetime.datetime` or sequence of `~datetime.datetime`
Dates are returned in timezone *tz*.
If *x* is a sequence, a sequence of `~datetime.datetime` objects will
be returned.
Notes
-----
The Gregorian calendar is assumed; this is not universal practice.
For details, see the module docstring.
)r@Ú_from_ordinalf_np_vectorizedrk)rpr9s r?rrÉs#€ô4
�R‹€BÜ '¨¨2Ó .× 5Ñ 5Ó 7Ð7rAcó.—tj|¬«S)N)Údays)r<ro©rps r?ú<lambda>r�ès€Œh× Ñ  aÔ(€rAcó4—t|«j«S)a
Convert number of days to a `~datetime.timedelta` object.
If *x* is a sequence, a sequence of `~datetime.timedelta` objects will
be returned.
Parameters
----------
x : float, sequence of floats
Number of days. The fraction part represents hours, minutes, seconds.
Returns
-------
`datetime.timedelta` or list[`datetime.timedelta`]
)Ú$_ordinalf_to_timedelta_np_vectorizedrkrŽs r?rrës€ô 0°Ó 2× 9Ñ 9Ó ;Ð;rAcó—t|«}t|«}|j«tz }tt j
||z
|z ««}|||zz}||k\r
||z}|dz}t|«}t j |||dz«S)a«
Return a sequence of equally spaced Matplotlib dates.
The dates start at *dstart* and reach up to, but not including *dend*.
They are spaced by *delta*.
Parameters
----------
dstart, dend : `~datetime.datetime`
The date limits.
delta : `datetime.timedelta`
Spacing of the dates.
Returns
-------
`numpy.array`
A list floats representing Matplotlib dates.
rC)rÚ
total_secondsrTrhrQÚceilÚlinspace)ÚdstartÚdendÚdeltaÚf1Úf2ÚstepÚnumÚ
dinterval_ends r?rrþs˜€ô(
�&Ó €BÜ �$‹€BØ × Ñ Ó ¤;Ñ .€Dô Œb�g‰g�r˜B‘w $Ñ&Ó'Ó
(€Cð˜S 5™[Ñ(€Mð˜Òð ˜Ñˆ
Ø ˆq‰ˆä �-Ó €BÜ
�;‰;�r˜2˜s Q™wÓ 'Ð'rAcóÔ—d}tj|d|«}|jdd«jdd«}|jdd«}d |zd
z}|jd d «}|S)
Nz ([a-zA-Z]+)z}$\1$\\mathdefault{ú-z{-}ú:z{:}ú z\;z$\mathdefault{z}$z$\mathdefault{}$Ú)ÚreÚsubrl)ÚtextÚpÚret_texts r?Ú _wrap_in_texr¨'st€Ø€AÜ�v‰v�aÐ/°Ó6€Hð×Ñ  UÓ+×3Ñ3°C¸Ó?€Hà×Ñ  UÓ+€HØ  8Ñ+¨dÑ2€HØ×ÑÐ 3°RÓ8€HØ €OrAcó,—eZdZdZdddœd„Zdd„Zd„Zy) rzi
Format a tick (in days since the epoch) with a
`~datetime.datetime.strftime` format string.
N©Úusetexcóh—t|«|_||_tj|d«|_y)a¦
Parameters
----------
fmt : str
`~datetime.datetime.strftime` format string
tz : str or `~datetime.tzinfo`, default: :rc:`timezone`
Ticks timezone. If a string, *tz* is passed to `dateutil.tz`.
usetex : bool, default: :rc:`text.usetex`
To enable/disable the use of TeX's math mode for rendering the
results of the formatter.
ú text.usetexN)r@r9Úfmtr4r5Ú_usetex)Úselfr®r9r«s r?Ú__init__zDateFormatter.__init__=s(€ô˜b“/ˆŒØˆŒÜ—~‘~ f¨mÓ<ˆ� rAcó’—t||j«j|j«}|jr t |«S|S©N)rr9Ústrftimer®r¯r¨)r°rpÚposÚresults r?Ú__call__zDateFormatter.__call__Ms7€Ü˜!˜TŸW™WÓ%×.Ñ.¨t¯x©xÓ8ˆØ'+§|¢|Œ|˜FÓ#Ð?¸Ð?rAcó$—t|«|_yr³©r@r9©r°r9s r?Ú
set_tzinfozDateFormatter.set_tzinfoQs
€Ü˜b“/ˆ�rAr³)r)Ú__name__Ú
__module__Ú __qualname__Ú__doc__r±r·r»rGrAr?rr7s„ñð
=¨tô=ó @ó"rArcó<—eZdZdZ d ddœd„Zd
d„Zd„Zd„Zd„Zy) raË
A `.Formatter` which 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 `AutoDateLocator`::
>>> locator = AutoDateLocator()
>>> formatter = ConciseDateFormatter(locator)
Parameters
----------
locator : `.ticker.Locator`
Locator that this axis is using.
tz : str or `~datetime.tzinfo`, default: :rc:`timezone`
Ticks timezone, passed to `.dates.num2date`.
formats : list of 6 strings, optional
Format strings for 6 levels of tick labelling: mostly years,
months, days, hours, minutes, and seconds. Strings use
the same format codes as `~datetime.datetime.strftime`. Default is
``['%Y', '%b', '%d', '%H:%M', '%H:%M', '%S.%f']``
zero_formats : list of 6 strings, optional
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
``['', '%Y', '%b', '%b-%d', '%H:%M', '%H:%M']``
offset_formats : list of 6 strings, optional
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
date. The default is::
['', '%Y', '%Y-%b', '%Y-%b-%d', '%Y-%b-%d', '%Y-%b-%d %H:%M']
show_offset : bool, default: True
Whether to show the offset or not.
usetex : bool, default: :rc:`text.usetex`
To enable/disable the use of TeX's math mode for rendering the results
of the formatter.
Examples
--------
See :doc:`/gallery/ticks/date_concise_formatter`
.. plot::
import datetime
import matplotlib.dates as mdates
base = datetime.datetime(2005, 2, 1)
dates = np.array([base + datetime.timedelta(hours=(2 * i))
for i in range(732)])
N = len(dates)
np.random.seed(19680801)
y = np.cumsum(np.random.randn(N))
fig, ax = plt.subplots(constrained_layout=True)
locator = mdates.AutoDateLocator()
formatter = mdates.ConciseDateFormatter(locator)
ax.xaxis.set_major_locator(locator)
ax.xaxis.set_major_formatter(formatter)
ax.plot(dates, y)
ax.set_title('Concise Date Formatter')
Nrªcóú—||_||_d|_|r!t|«dk7r t d«‚||_n gd¢|_|r!t|«dk7r t d«‚||_nB|rdg|j
ddz|_n'dg|j
ddz|_d |j d
<|r!t|«dk7r t d «‚||_n gd ¢|_d|_||_ tj|d
«|_ y)z•
Autoformat the date labels. The default format is used to form an
initial string, and then redundant elements are removed.
ú%Yéz=formats argument must be a list of 6 format strings (or None))rÂz%bz%dú%H:%MrÄz%S.%fzBzero_formats argument must be a list of 6 format strings (or None)r¢Néÿÿÿÿz%b-%dézDoffset_formats argument must be a list of 6 format strings (or None))r¢rÂz%Y-%bú%Y-%b-%drÇz%Y-%b-%d %H:%Mr­)
Ú_locatorÚ_tzÚ
defaultfmtÚlenr;ÚformatsÚ zero_formatsÚoffset_formatsÚ
offset_stringÚ show_offsetr4r5r¯)r°Úlocatorr9rÌrÎrÍrÐr«s r?r±zConciseDateFormatter.__init__œs€ð  ˆŒ
؈ŒØˆŒñ Ü�7‹|˜qÒ Ü ð">ó?ð?à"ˆD�LòˆDŒLñ Ü�<Ó  AÒ%Ü ð">ó?ð?à ,ˆDÕ Ù
à!#  t§|¡|°C°RÐ'8Ñ 8ˆDÕ ð"$  t§|¡|°C°RÐ'8Ñ 8ˆDÔ Ø#*ˆD× Ñ ˜aÑ á Ü�>Ó" aÒ'Ü ð">ó?ð?à"0ˆDÕ ò#5ˆDÔ ð  ˆÔØ&ˆÔÜ—~‘~ f¨mÓ<ˆ� rAcón—t|j|j|j¬«}|||¬«S)Nrª)rµ)rrÊrÉr¯)r°rprµÚ formatters r?r·zConciseDateFormatter.__call__Ös,€Ü! $§/¡/°4·8±8Ø)-¯©ô7ˆ ᘠÔ$Ð$rAcóª—|D�cgc]}t||j¬«‘Œ}}tj|D�cgc]}|j «dd‘Œc}«}|j
}|j }|j}|j} tddd«D]U}
tj|dd…|
f«} t| «dkDr!|
dkrtj| dk(«rd} n
|
dk(sŒTd}
ŒWgd ¢} d
gt|«z}
tt|««D]k}
dkr|||
| |
k(r||
}n9||
}n3||j||jcxk(rdk(r nn||
}n||
}||j|«|
|<Œm
dk\rRt!d „|
D«d¬ «}|r<tt|
««D]%}d
|
|vsŒ |
|d| j#d
«|
|<Œ'| r¼|j$j&rc|j$j&j(dvrA|j$j&j+«r|dj||
«|_n|dj||
«|_|j.r"t1|j,«|_nd
|_|j.r|
D�cgc]
}t1|«‘Œc}S|
Scc}wcc}wcc}w)N©r9rÃérÅrCéFr)rrCrCrrrrr¢c3órK—|]/}d|vsŒt|«t|jd««z
–—Œ1y­w)r3Ú0N)rËÚrstrip)Ú.0rNs r?ú <genexpr>z4ConciseDateFormatter.format_ticks.<locals>.<genexpr>s,èø€ÒI°ÀÀq”�Q“œ#˜aŸh™h s›mÓ,Õ,ÑIùs‚ 7Œ+7rvr3)ÚxaxisÚyaxis)rrÉrQÚarrayÚ timetuplerÌrÍrÎrÐÚrangeÚuniquerËÚanyÚsecondrer´ÚminrÚrÈÚaxisr¼Ú get_invertedrÏr¯r¨)r°ÚvaluesÚvalueÚ tickdatetimeÚtdtÚtickdateÚfmtsÚzerofmtsÚ
offsetfmtsrÐÚlevelrâÚzerovalsÚlabelsÚnnr®Útrailing_zerosÚls r?Ú format_ticksz!ConciseDateFormatter.format_ticksÛsÆ€ØBHÖI¸œ ¨4¯8©8Ö4ÐIˆ ÐIÜ—8‘8¸LÖI°S˜SŸ]™]›_¨R¨aÒ0ÒIÓJˆð�|‰|ˆà×$Ñ$ˆð×(Ñ(ˆ
Ø×&Ñ&ˆ ô
˜1˜b "Ó%ò
ˆEÜ—Y‘Y˜xª¨5¨Ñ1Ó2ˆFÜ�6‹{˜QŠà˜1’9¤§¡¨°!© Ô!4Ø"'�KÙØ˜!“ð‘ð
ò)ˆØ�œ˜H›
Ñ%ˆÜœ˜H›
Ó&ò
8ˆBØ�qŠyؘB‘< Ñ&¨(°5©/Ò9Ø" 5™/‘Cà˜u™+‘Cð! Ñ$×+Ñ+¨|¸BÑ/?×/KÑ/KôØõà" 5™/‘Cà˜u™+�CØ% bÑ)×2Ñ2°3Ó7ˆF�2ŠJð
8ð( �AŠ:Ü ÙI°fÔIØôˆNñܤ F£ Ó,òN�Bؘf R™jÒ(Ø%+¨B¡ZÐ0@°.°Ð%A×%HÑ%HÈÓ%M˜˜rš
ðNñ à—
‘
×"Ò"Ø—M‘M×&Ñ&×/Ñ/Ð3EÑEØŸ
™
×*Ñ*×7Ñ7Ô9Ø%1°!¡_×%=Ñ%=¸jÈÑ>OÓ%P�Õ"à%1°"Ñ%5×%>Ñ%>¸zÈ%Ñ?PÓ%Q�Ô"Ø�|Š|Ü%1°$×2DÑ2DÓ%E�Õ"à!#ˆDÔ à �<Š<Ø-3Ö4¨”L •OÒ4Ð 4àˆMùòcJùÚIùò\5s…K¸K Ê/Kcó—|jSr³)rÏ©r°s r?Ú
get_offsetzConciseDateFormatter.get_offset/s€Ø×!Ñ!Ð!rAcóN—t||j¬«jd«S)NrÕz%Y-%m-%d %H:%M:%S)rrÉr´)r°rés r?Úformat_data_shortz&ConciseDateFormatter.format_data_short2s€Ü˜ $§(¡(Ô+×4Ñ4Ð5HÓIÐIrA)NNNNTr³) r¼r½r¾r¿r±r·rörùrûrGrAr?rrUs8„ñDðLGKØ04ð8=Ø@Dô8=ót%ò
Ròh"óJrArcó,—eZdZdZdddœd„Zd„Zdd„Zy) r a
A `.Formatter` which attempts to figure out the best format to use. This
is most useful when used with the `AutoDateLocator`.
`.AutoDateFormatter` has a ``.scale`` dictionary that maps tick scales (the
interval in days between one major tick) to format strings; this dictionary
defaults to ::
self.scaled = {
DAYS_PER_YEAR: rcParams['date.autoformatter.year'],
DAYS_PER_MONTH: rcParams['date.autoformatter.month'],
1: rcParams['date.autoformatter.day'],
1 / HOURS_PER_DAY: rcParams['date.autoformatter.hour'],
1 / MINUTES_PER_DAY: rcParams['date.autoformatter.minute'],
1 / SEC_PER_DAY: rcParams['date.autoformatter.second'],
1 / MUSECONDS_PER_DAY: rcParams['date.autoformatter.microsecond'],
}
The formatter uses the format string corresponding to the lowest key in
the dictionary that is greater or equal to the current scale. Dictionary
entries can be customized::
locator = AutoDateLocator()
formatter = AutoDateFormatter(locator)
formatter.scaled[1/(24*60)] = '%M:%S' # only show min and sec
Custom callables can also be used instead of format strings. 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::
def my_format_function(x, pos=None):
x = matplotlib.dates.num2date(x)
if pos == 0:
fmt = '%D %H:%M:%S.%f'
else:
fmt = '%H:%M:%S.%f'
label = x.strftime(fmt)
label = label.rstrip("0")
label = label.rstrip(".")
return label
formatter.scaled[1/(24*60)] = my_format_function
NrªcóV—||_||_||_t|j|«|_t
j }t j|d«|_t|dt|dd|ddtz |ddtz |ddtz |ddtz |d i|_y
) a.
Autoformat the date labels.
Parameters
----------
locator : `.ticker.Locator`
Locator that this axis is using.
tz : str or `~datetime.tzinfo`, default: :rc:`timezone`
Ticks timezone. If a string, *tz* is passed to `dateutil.tz`.
defaultfmt : str
The default format to use if none of the values in ``self.scaled``
are greater than the unit returned by ``locator._get_unit()``.
usetex : bool, default: :rc:`text.usetex`
To enable/disable the use of TeX's math mode for rendering the
results of the formatter. If any entries in ``self.scaled`` are set
as functions, then it is up to the customized function to enable or
disable TeX's math mode itself.
r­zdate.autoformatter.yearzdate.autoformatter.monthrCzdate.autoformatter.dayzdate.autoformatter.hourzdate.autoformatter.minutezdate.autoformatter.secondzdate.autoformatter.microsecondN)rÈrÉrÊrÚ
_formatterr4ÚrcParamsr5r¯Ú
DAYS_PER_YEARÚDAYS_PER_MONTHÚ
HOURS_PER_DAYÚMINUTES_PER_DAYrTrjÚscaled)r°rÑr9rÊr«rÿs r?r±zAutoDateFormatter.__init__ns°€ð. ˆŒ
؈ŒØ$ˆŒÜ'¨¯©¸Ó<ˆŒÜ—<‘<ˆÜ—~‘~ f¨mÓ<ˆŒ ä ˜8Ð$=Ñ>Ü ˜HÐ%?Ñ@Ø
ˆxÐ0Ñ1Ø
”
Ñ ˜xÐ(AÑBØ
”Ñ  Ð*EÑ!FØ
” ‰O˜XÐ&AÑBØ
Ô!Ñ ! 8Ð,LÑ#Mð
ˆ� rAcó—||_yr³)rÈ)r°rÑs r?Ú _set_locatorzAutoDateFormatter._set_locator•s €Øˆ�
rAcó·— t|jj««Št ˆfd„t |j j««D«|j«}t|t«r;t||j|j¬«|_|j||«}|St|«r |||«}|St!d|›d�«‚#t$rdŠYŒ½wxYw)NrCc3ó2•K—|]\}}|‰k\r|–—Œy­wr³rG)rÛÚscaler®Úlocator_unit_scales €r?rÜz-AutoDateFormatter.__call__.<locals>.<genexpr>žs%øèø€ò4™J˜E 3ØÐ 2Ò2ôñ4ùsƒrªzUnexpected type passed to r3)ÚfloatrÈÚ _get_unitÚAttributeErrorÚnextÚsortedrÚitemsrÊr6r7rrÉr¯rþÚcallabler>)r°rprµr®r¶r
s @r?r·zAutoDateFormatter.__call__˜sÕø€ð #Ü!& t§}¡}×'>Ñ'>Ó'@Ó!AÐ ôó4¬&°·±×1BÑ1BÓ1DÓ*Eô4à—?‘?ó$ˆô �cœ3Ô Ü+¨C°·±À$Ç,Á,ÔOˆDŒOØ—_‘_ Q¨Ó,ˆFð ˆ
ô �cŒ]Ù˜˜C“[ˆFðˆ
ôÐ8¸¸ÀÐBÓCÐ Cøôò #Ø!"Ò ð #úsƒ#Cà C$Ã#C$)Nz%Y-%m-%dr³)r¼r½r¾r¿r±rr·rGrAr?r r 6s „ñ*ðn%
Øô%
òN ôrAr có>—eZdZdZd
d„Zd„Zd„Zd„Zd d„Zd„Z d „Z
y) r/zd
A simple wrapper around a `dateutil.rrule` allowing flexible
date tick specifications.
Nc ó@—||d<||_|jdi|¤Žy)aÐ
Parameters
----------
freq : {YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY}
Tick frequency. These constants are defined in `dateutil.rrule`,
but they are accessible from `matplotlib.dates` as well.
tzinfo : `datetime.tzinfo`, optional
Time zone information. The default is None.
**kwargs
Additional keyword arguments are passed to the `dateutil.rrule`.
ÚfreqNrG)Ú _base_tzinfoÚ
_update_rrule)r°rr=Úkwargss r?r±zrrulewrapper.__init__²s(€ðˆˆv‰Ø"ˆÔàˆ×ÑÑ$˜VÓ$rAc ór—|jj|«|jdi|j¤Žy)z'Set parameters for an existing wrapper.NrG)Ú
_constructÚupdater)r°rs r?Úsetzrrulewrapper.setÃs+€à �‰×јvÔ&àˆ×ÑÑ-˜TŸ_™_Ó-rAc ó®—|j}d|vrF|d}|j�5|€
|j}n|j|«}|jd¬«|d<d|vrE|d}|j�4|�|j|«}n t d«‚|jd¬«|d<|j «|_||_tdi|j ¤Ž|_ y)NÚdtstartraÚuntilz<until cannot be aware if dtstart is naive and tzinfo is NonerG)
rr=rmrlr;ÚcopyrÚ_tzinforÚ_rrule)r°rr=rrs r?rzrrulewrapper._update_rruleÉsá€Ø×"Ñ"ˆð
˜Ñ ؘYÑ'ˆGØ�~‰~Ð)Ø�>Ø$Ÿ^™^‘Fà%×0Ñ0°Ó8�Gà$+§O¡O¸4 OÓ$@��yÑ!à �fÑ Ø˜7‘OˆEØ�|‰|Ð'ØÐ%Ø!×,Ñ,¨VÓ4‘Eä$ð&CóDðDð#(§-¡-°t -Ó"<��w‘à Ÿ+™+›-ˆŒØˆŒ ÜÑ.˜dŸo™oÑ.ˆ� rAcód—t|d«r|j|d¬«S|j|¬«S)NÚlocalizeT)Úis_dstra)Úhasattrr#rl)r°r[r=s r?Ú_attach_tzinfozrrulewrapper._attach_tzinfoès0€ä �6˜:Ô &Ø—?‘? 2¨d�?Ó3Ð 3à�z‰z ˆzÓ(Ð(rAc󒇇‡‡—‰j€‰Sˆfd„Šˆfd„Š|sˆˆˆfd„}nˆˆˆfd„}tj‰«|«S)z>Decorator function that allows rrule methods to handle tzinfo.cóÞ•—t|tj«rQ|j�E|j‰jur|j ‰j«}|j d¬«S|S)Nra)r6r<r=r rmrl)Úargr°s €r?Ú
normalize_argz9rrulewrapper._aware_return_wrapper.<locals>.normalize_arg÷sTø€Ü˜#œx×0Ñ0Ô1°c·j±jÐ6LØ—:‘: T§\¡\Ñ1ØŸ.™.¨¯©Ó6�Cà—{‘{¨$�{Ó/Ð/àˆJrAcó’•—tˆfd„|D««}|j«D��cic]\}}|‰|«“Œ}}}||fScc}}w)Nc3ó.•K—|] }‰|«–—Œy­wr³rG)rÛr)r*s €r?rÜzMrrulewrapper._aware_return_wrapper.<locals>.normalize_args.<locals>.<genexpr>søèø€Ò<°™ s×+Ñ<ùsƒ)Útupler)ÚargsrÚkwr)r*s €r?Únormalize_argsz:rrulewrapper._aware_return_wrapper.<locals>.normalize_argssJø€ÜÓ<°tÔ<Ó<ˆDØ<B¿L¹L»N×K±°°S�b™-¨Ó,Ñ,ÐKˆFÑKà˜�<Ð ùóLs©Acód•—‰||«\}}‰|i|¤Ž}‰j|‰j«Sr³©r&r )r.rr[Úfr0r°s €€€r?Ú
inner_funcz6rrulewrapper._aware_return_wrapper.<locals>.inner_func s9ø€Ù-¨d°FÓ;‘ ��fÙ˜Ð' Ñ'�Ø×*Ñ*¨2¨t¯|©|Ó<Ð<rAcóŠ•—‰||«\}}‰|i|¤Ž}|D�cgc]}‰j|‰j«‘Œ c}Scc}wr³r2)r.rÚdtsr[r3r0r°s €€€r?r4z6rrulewrapper._aware_return_wrapper.<locals>.inner_funcsGø€Ù-¨d°FÓ;‘ ��fÙ˜Ð( Ñ(�ØHKÖLÀ"˜×+Ñ+¨B°· ± Õ=ÒLÐLùÒLsš#A)r Ú functoolsÚwraps)r°r3Ú returns_listr4r*r0s`` @@r?Ú_aware_return_wrapperz"rrulewrapper._aware_return_wrapperïsFû€ð �<‰<Р؈Hô ô ñ÷
=ö

Mð
"Œy�‰˜qÓ! *Ó-Ð-rAcóÄ—||jvr|j|St|j|«}|dvr|j|«S|dvr|j|d¬«S|S)N>ÚafterÚbefore>ÚxafterÚbetweenÚxbeforeT)r9)Ú__dict__r†r!r:)r°Únamer3s r?Ú __getattr__zrrulewrapper.__getattr__sk€Ø �4—=‘=Ñ Ø—=‘= Ñ&Ð &ä �D—K‘K Ó &ˆà Ð&Ñ &Ø×-Ñ-¨aÓ0Ð 0Ø
Ð5Ñ
5Ø×-Ñ-¨a¸dÐ-ÓCÐ CàˆHrAcó:—|jj|«yr³)rAr)r°Ústates r?Ú __setstate__zrrulewrapper.__setstate__"s€Ø �
‰
×јUÕ#rAr³)F) r¼r½r¾r¿r±rrr&r:rCrFrGrAr?r/r/­s+„ñó%ò".ò /ò>)ó$.òL ó$rAr/cóH—eZdZdZddddœZd d„Zd„Zd„Zd„Zd „Z d
„Z
d „Z y)
r!z˜
Determines the tick locations when plotting dates.
This class is subclassed by other Locators and
is not meant to be used on its own.
r)ÚbyhourÚbyminuteÚbysecondNcó$—t|«|_y)z¹
Parameters
----------
tz : str or `~datetime.tzinfo`, default: :rc:`timezone`
Ticks timezone. If a string, *tz* is passed to `dateutil.tz`.
Nr¹rºs r?r±zDateLocator.__init__/s€ô˜b“/ˆ�rAcó$—t|«|_y)zÕ
Set timezone info.
Parameters
----------
tz : str or `~datetime.tzinfo`, default: :rc:`timezone`
Ticks timezone. If a string, *tz* is passed to `dateutil.tz`.
Nr¹rºs r?r»zDateLocator.set_tzinfo8s€ô˜b“/ˆ�rAcó¦—|jj«\}}||kDr||}}t||j«t||j«fS)z/Convert axis data interval to datetime objects.)ræÚget_data_intervalrr9©r°ÚdminÚdmaxs r?Ú
datalim_to_dtzDateLocator.datalim_to_dtCsI€à—Y‘Y×0Ñ0Ó2‰
ˆˆdØ �$Š;ؘt�$ˆD䘘dŸg™gÓ&¬°°t·w±wÓ(?Ð?Ð?rAcó¦—|jj«\}}||kDr||}}t||j«t||j«fS)z.Convert the view interval to datetime objects.)ræÚget_view_intervalrr9©r°ÚvminÚvmaxs r?Ú
viewlim_to_dtzDateLocator.viewlim_to_dtKsI€à—Y‘Y×0Ñ0Ó2‰
ˆˆdØ �$Š;ؘt�$ˆDܘ˜dŸg™gÓ&¬°°t·w±wÓ(?Ð?Ð?rAcó—y)zj
Return how many days a unit of the locator is; used for
intelligent autoscaling.
rCrGrøs r?r zDateLocator._get_unitRs€ð
rAcó—y)z;
Return the number of units for each tick.
rCrGrøs r?Ú
_get_intervalzDateLocator._get_intervalYs€ðrAcó~—tj|«rtj|«s@ttjddd««ttjddd««fS||kr||}}|j «}|j
«}t||z
«dkr|d|z|zz}|d|z|zz
}||fS)z�
Given the proposed upper and lower extent, adjust the range
if it is too close to being singular (i.e. a range of ~0).
rBrCr×g�íµ ÷ư>)rQÚisfiniterr<Údater r[rn)r°rVrWÚunitÚintervals r?Ú nonsingularzDateLocator.nonsingular_sº€ô
�{‰{˜4Ô ¬¯ © °DÔ(9äœXŸ]™]¨4°°AÓ6Ó7ÜœXŸ]™]¨4°°AÓ6Ó7ð9ð
9à �$Š;ؘt�$ˆDØ�~‰~ÓˆØ×%Ñ%Ó'ˆÜ ˆt�d‰{Ó ˜dÒ "Ø �A˜‘H˜xÑ'Ñ 'ˆDØ �A˜‘H˜xÑ'Ñ 'ˆDØ�TˆzÐrAr³) r¼r½r¾r¿Úhms0dr±r»rRrXr r[rarGrAr?r!r!&s:„ñð  a°QÑ 7€Eó"ò "ò@ò@òòó rAr!cóN‡—eZdZdˆfd„ Zd„Zd„Zd„Zd„Zed„«Z d„Z
ˆxZ S) r"có2•—t‰|�|«||_yr³)Úsuperr±Úrule)r°Úor9Ú __class__s €r?r±zRRuleLocator.__init__usø€Ü
‰Ñ˜Ô؈� rAcóp— |j«\}}|j||«S#t$rgcYSwxYwr³©rXr;Ú tick_valuesrOs r?r·zRRuleLocator.__call__yóD€ð Ø×+Ñ+Ó-‰JˆD�$ð×Ñ  dÓ+Ð+øôò ØŠIð úó ‚'§ 5´5cóЗ|j||«\}}|jj||d«}t|«dk(r
t ||g«S|j t |««S)NTr)Ú
_create_rrulerfr?rËrÚraise_if_exceeds)r°rVrWÚstartÚstopÚdatess r?rkzRRuleLocator.tick_values‚s_€Ø×(Ñ(¨¨tÓ4‰ ˆˆtØ— ‘ ×!Ñ! %¨¨tÓ4ˆÜ ˆu‹:˜Š?ܘT 4˜LÓ)Ð )Ø×$Ñ$¤X¨e£_Ó5Ð5rAc
ó˜—t||«} ||z
} ||z}|j j||¬ «||fS#ttf$r7tjddddddtjj
¬«}YŒlwxYw#ttf$r7tjddddddtjj
¬«}YŒ¯wxYw)
NrCrraé'é ééé;©rr)rr;Ú
OverflowErrorr<r1Úutcrfr)r°rVrWr˜rqrrs r?rozRRuleLocator._create_rrule‰sÕ€ô˜d DÓ)ˆð Dؘ5‘LˆEð  Cؘ%‘<ˆDð
� ‰ �
‰
˜e¨4ˆ
Ô0à�TˆzÐøôœMÐ*ò Dä×%Ñ% a¨¨A¨q°!°QÜ-5×->Ñ->×-BÑ-BôDŠEð DûôœMÐ*ò Cä×$Ñ$ T¨2¨r°2°r¸2Ü,4×,=Ñ,=×,AÑ,AôCŠDð Cús"Ž:”BºABÁ?BÂAC ÃC cód—|jjj}|j|«Sr³)rfr!Ú_freqÚget_unit_generic)r°rs r?r zRRuleLocator._get_unit¡s(€à�y‰y×Ñ×%Ñ%ˆØ×$Ñ$ TÓ*Ð*rAcóÞ—|tk(rtS|tk(rtS|tk(rt
S|t k(ry|tk(r dtz S|tk(r dtz S|tk(r dtz Sy)Nçð?rÅ)
r rr rr
Ú
DAYS_PER_WEEKrrrrrrrT)rs r?rzRRuleLocator.get_unit_generic¦sp€à ”6Š>Ü Ð Ø
”WŠ_Ü!Ð !Ø
”VŠ^Ü Ð Ø
”UŠ]ØØ
”VŠ^ØœÑ&Ð &Ø
”XÒ
ØœÑ(Ð (Ø
”XÒ
ØœÑ$Ð $ðrAcóB—|jjjSr³)rfr!Ú _intervalrøs r?r[zRRuleLocator._get_intervalºs€Ø�y‰y×Ñ×)Ñ)Ð)rAr³) r¼r½r¾r±r·rkror Ú staticmethodrr[Ú
__classcell__©rhs@r?r"r"rs5ø„õò,ò6òò0+ð
ñóðö&*rAr"cóF‡—eZdZdZ dˆfd„ Zd„Zd„Zd„Zd„Zd„Z ˆxZ
S) r#a­
On autoscale, this class picks the best `DateLocator` to set the view
limits and the tick locations.
Attributes
----------
intervald : dict
Mapping of tick frequencies to multiples allowed for that ticking.
The default is ::
self.intervald = {
YEARLY : [1, 2, 4, 5, 10, 20, 40, 50, 100, 200, 400, 500,
1000, 2000, 4000, 5000, 10000],
MONTHLY : [1, 2, 3, 4, 6],
DAILY : [1, 2, 3, 7, 14, 21],
HOURLY : [1, 2, 3, 4, 6, 12],
MINUTELY: [1, 5, 10, 15, 30],
SECONDLY: [1, 5, 10, 15, 30],
MICROSECONDLY: [1, 2, 5, 10, 20, 50, 100, 200, 500,
1000, 2000, 5000, 10000, 20000, 50000,
100000, 200000, 500000, 1000000],
}
where the keys are defined in `dateutil.rrule`.
The interval is used to specify multiples that are appropriate for
the frequency of ticking. For instance, every 7 days is sensible
for daily ticks, but for minutes/seconds, 15 or 30 make sense.
When customizing, you should only modify the values for the existing
keys. You should not add or delete entries.
Example for forcing ticks every 3 hours::
locator = AutoDateLocator()
locator.intervald[HOURLY] = [3] # only show every 3 hours
cóÞ•—t‰|�|¬«t|_ttt
t tttg|_
||_ tdtdt
dt dtdtdtdi|_ |� |jj|«||_tgd¢tgd¢t
gd¢t gd ¢tgd
¢tgd
¢tgd ¢i|_|rgd ¢|j$t
<dt'd
d«t'd
d«t'dd«t'dd«t'dd«dg|_y#t$r(tj!|j|«|_ YŒÎwxYw)a­
Parameters
----------
tz : str or `~datetime.tzinfo`, default: :rc:`timezone`
Ticks timezone. If a string, *tz* is passed to `dateutil.tz`.
minticks : int
The minimum number of ticks desired; controls whether ticks occur
yearly, monthly, etc.
maxticks : int
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 `AutoDateFormatter`. Any
frequency not specified in this dictionary is given a default
value.
interval_multiples : bool, default: True
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
at 6 hour intervals.
rÕé rvéN)rCr×érÖé
rcé(é2édéÈi�éôéèéÐi éˆé')rCr×rÆrŒrÃ)rCr×rÆééé)rCr×rÆrŒrÃrv)rCrÖr�éé)rCr×rÖr�rcr�r�r‘r’r“r”r•r–i NiPÃi †i@
i ¡rd)rCr×rŒr—r˜rCé
é réé<)rer±r r~r rrrrr,Ú_freqsÚminticksÚmaxticksrr>ÚdictÚfromkeysÚinterval_multiplesÚ intervaldráÚ _byranges)r°r9r¡r¢r¥rhs €r?r±zAutoDateLocator.__init__æs:ø€ô2 ‰Ñ˜BÐÔ܈Œ
Üœw¬¬v´xܤð0ˆŒ à ˆŒ
ä ¤W¨b´%¸¼VÀRÜ! 2¤x°´]ÀAðGˆŒ
à Ð ð
EØ—
‘
×$Ñ$ XÔ.ð #5ˆÔä ò6ä ’oÜ Ò*Ü Ò)Ü Ò(Ü Ò(Ü ò%𠈌ñ ò%5ˆD�N‰Nœ5Ñ !ठa¨£ ¬e°A°r«lÜ  2›,¬¨a°« ´e¸A¸r³lÀDðJˆ�øô1ò
Eô!%§
¡
¨d¯k©k¸8Ó D�–
ð 
EúsÂD;Ä;.E,Å+E,cóZ—|j«\}}|j||«}|«Sr³)rXÚ get_locator)r°rPrQrÑs r?r·zAutoDateLocator.__call__%s.€à×'Ñ'Ó)‰
ˆˆdØ×"Ñ" 4¨Ó.ˆÙ‹yÐrAcóF—|j||«j||«Sr³)r©rkrUs r?rkzAutoDateLocator.tick_values+s"€Ø×Ñ  dÓ+×7Ñ7¸¸dÓCÐCrAcó*—tj|«rtj|«s@ttjddd««ttjddd««fS||kr||}}||k(r|t
dzz
}|t
dzz}||fS)NrBrCr×)rQr]rr<r^rrUs r?razAutoDateLocator.nonsingular.sŽ€ô�{‰{˜4Ô ¬¯ © °DÔ(9äœXŸ]™]¨4°°AÓ6Ó7ÜœXŸ]™]¨4°°AÓ6Ó7ð9ð
9à �$Š;ؘt�$ˆDØ �4Š<Øœ-¨!Ñ+Ñ+ˆDØœ-¨!Ñ+Ñ+ˆDØ�TˆzÐrAcóx—|jtfvr dtz Stj |j«S©Nr�)r~r,rjr"rrøs r?r zAutoDateLocator._get_unit<s1€Ø �:‰:œ-˜Ñ (ØÔ)Ñ)Ð )ä×0Ñ0°·±Ó<Ð <rAc óœ—t||«}||z
}||kDr| }| }t|j«}|tz|jz}|j
}|t z|jz}|tz|jz} tj|j««}
tj|j«dz«} ||||| |
| g} dgdzdgz}
gd¢}tt|j| ««D]ð\}\}}||j krd||<Œ|j"|D]}|||j$|dz
zksŒn/|j&r |t(k(st+j,d›d �«||_|j0|rN|j&rB|j0|dd…||<|t(t2fvr|d
k(rdd g||<n |d k(rgd
¢||<d}n|j0|||<nd}t4k(r$|j&rt7|j8¬«}n�|
r@|\}}}}}}}t;|j.|||||||¬« }t=||j8¬«}nKt?|j8¬«}tA|«dkDr&|dkr!t+j,dtC«›d�«|jE|jF«|S)z*Pick the best locator based on a distance.rDTrÃF)NrCrCrrrNNrCzºAutoDateLocator was unable to pick an appropriate interval for this date range. It may be necessary to add an interval value to the AutoDateLocator's intervald dictionary. Defaulting to r3r˜ršr—)rCr‹ršérÕ)r`rrÚbymonthÚ
bymonthdayrHrIrJrbr“zOPlotting microsecond time intervals for dates far from the epoch (time origin: zL) is not well-supported. See matplotlib.dates.set_epoch to change the epoch.)$rr ÚyearsÚMONTHS_PER_YEARÚmonthsr�rÚhoursÚ MIN_PER_HOURÚminutesrQÚfloorr“Ú enumerateÚzipr r¡r¦r¢r¥rrÚ
warn_externalr~r§r
r r$r9r/r"r+rrÚset_axisræ)r°rPrQr˜ÚtdeltaÚnumYearsÚ numMonthsÚnumDaysÚnumHoursÚ
numMinutesÚ
numSecondsÚnumMicrosecondsÚnumsÚuse_rrule_locatorÚbyrangesÚirrœr`rÑÚ_r°r±rHrIrJrs r?r©zAutoDateLocator.get_locatorBsô€ä˜d DÓ)ˆØ˜‘ˆð �$Š;Ø�FˆEØ�WˆFô
˜Ÿ™Ó%ˆØœÑ.°·±Ñ=ˆ Ø—+‘+ˆØœ]Ñ*¨U¯[©[Ñ8ˆØ¤ Ñ,¨u¯}©}Ñ<ˆ
Ü—X‘X˜f×2Ñ2Ó4Ó5ˆ
ÜŸ(™( 6×#7Ñ#7Ó#9¸CÑ#?Ó@ˆà˜) W¨h¸
ؘOð-ˆð"˜F Q™J¨%¨Ñ0Ðò
/ˆô(¬¨D¯K©K¸Ó(>Ó?ò' ‰NˆA‰{��cà�T—]‘]Ò"ð#�˜‘ Øð!ŸN™N¨4Ñ0ò
L�ؘ( d§m¡m°DÑ&9¸AÑ&=Ñ>Ó>Ùð
Lð×/Ò/°D¼E²MÜ×&Ñ&ð?ð@H¸jÈðKôLðˆDŒJà�~‰~˜aÒ  T×%<Ò%<Ø"Ÿn™n¨QÑ/±
°(°
Ñ;�˜‘ Øœ¤˜Ñ'Ø 2’~à'(¨" g˜ š Ø! QšÚ&4˜ ™ à‘à"Ÿn™n¨QÑ/�˜‘ Ù ðK' ðNˆHà ”FŠN × 7Ò 7Ü! (¨t¯w©wÔ7‰GØ
˜qÒ
!ØDLÑ AˆAˆw˜
 F¨H°hÀÜ  §¡°hØ)-°TØ)0¸ZØ(.¸Ø*2ô 4ˆEô # 5¨T¯W©WÔ5‰Gä(¨°d·g±gÔ>ˆGܘ‹~ Ò(¨X¸ª_Ü×"Ñ"ð/Ü/8«{¨mð<ðôð ×јŸ™Ô#؈rA)NrÖNT) r¼r½r¾r¿r±r·rkrar r©r†r‡s@r?r#r#¾s3ø„ñ%ðN6:Ø$(õ=Jò~ò Dò ò=ö brAr#có*‡—eZdZdZdˆfd„ Zd„ZˆxZS)r$zõ
Make ticks on a given day of each year that is a multiple of base.
Examples::
# Tick every year on Jan 1st
locator = YearLocator()
# Tick every 5 years on July 4th
locator = YearLocator(5, month=7, day=4)
cóš•—ttf|||dœ|j¤Ž}t‰|�||¬«t j |d«|_y)aÖ
Parameters
----------
base : int, default: 1
Mark ticks every *base* years.
month : int, default: 1
The month on which to place the ticks, starting from 1. Default is
January.
day : int, default: 1
The day on which to place the ticks.
tz : str or `~datetime.tzinfo`, default: :rc:`timezone`
Ticks timezone. If a string, *tz* is passed to `dateutil.tz`.
)r`r°r±rÕrN)r/r rbrer±rÚ
_Edge_integerÚbase)r°rÍÚmonthÚdayr9rfrhs €r?r±zYearLocator.__init__³sOø€ôœFð:¨T¸5Ø'*ñ:Ø.2¯j©jñ:ˆä
‰Ñ˜ "ÐÔ%Ü×(Ñ(¨¨qÓ1ˆ� rAcó"—t|jj|j«|jjzd«}t |jj
|j«|jjzd«}|jj}||jdd«|jdd«ddddœ}|jd i|¤Ž}|j|¬«}|jj||¬«||fS)
NrCrur°r±r)ÚyearrÎrÏÚhourÚminuterä)rÑrzrG) ÚmaxrÍÚlerÑr›råÚgerfrÚgetrlr) r°rVrWÚyminÚymaxÚcrlrqrrs r?rozYearLocator._create_rruleÆs×€ô�4—9‘9—<‘< § ¡ Ó*¨T¯Y©Y¯^©^Ñ;¸QÓ?ˆÜ�4—9‘9—<‘< § ¡ Ó*¨T¯Y©Y¯^©^Ñ;¸TÓBˆà �I‰I× Ñ ˆØØŸE™E )¨QÓ/ØŸ%™%  ¨aÓ0ب°Qñ8ˆð
�— ‘ Ñ'˜wÑ'ˆØ�}‰} $ˆ}Ó'ˆØ � ‰ �
‰