Skip to content

Commit 875209e

Browse files
authored
Merge pull request #23048 from oscargus/rrulewrapperdocs
Add rrulewrapper to docs
2 parents f25c2d0 + 3b53e9d commit 875209e

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

doc/api/dates_api.rst

+1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
.. automodule:: matplotlib.dates
1010
:members:
1111
:undoc-members:
12+
:exclude-members: rrule
1213
:show-inheritance:

lib/matplotlib/dates.py

+16-4
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@
142142
143143
* `YearLocator`: Locate years that are multiples of base.
144144
145-
* `RRuleLocator`: Locate using a ``matplotlib.dates.rrulewrapper``.
146-
``rrulewrapper`` is a simple wrapper around dateutil_'s `dateutil.rrule`
145+
* `RRuleLocator`: Locate using a `rrulewrapper`.
146+
`rrulewrapper` is a simple wrapper around dateutil_'s `dateutil.rrule`
147147
which allow almost arbitrary date tick specifications.
148148
See :doc:`rrule example </gallery/ticks/date_demo_rrule>`.
149149
@@ -195,7 +195,7 @@
195195
'rrule', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU',
196196
'YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY',
197197
'HOURLY', 'MINUTELY', 'SECONDLY', 'MICROSECONDLY', 'relativedelta',
198-
'DateConverter', 'ConciseDateConverter')
198+
'DateConverter', 'ConciseDateConverter', 'rrulewrapper')
199199

200200

201201
_log = logging.getLogger(__name__)
@@ -981,16 +981,28 @@ def __call__(self, x, pos=None):
981981

982982
class rrulewrapper:
983983
"""
984-
A simple wrapper around a ``dateutil.rrule`` allowing flexible
984+
A simple wrapper around a `dateutil.rrule` allowing flexible
985985
date tick specifications.
986986
"""
987987
def __init__(self, freq, tzinfo=None, **kwargs):
988+
"""
989+
Parameters
990+
----------
991+
freq : {YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY}
992+
Tick frequency. These constants are defined in `dateutil.rrule`,
993+
but they are accessible from `matplotlib.dates` as well.
994+
tzinfo : `datetime.tzinfo`, optional
995+
Time zone information. The default is None.
996+
**kwargs
997+
Additional keyword arguments are passed to the `dateutil.rrule`.
998+
"""
988999
kwargs['freq'] = freq
9891000
self._base_tzinfo = tzinfo
9901001

9911002
self._update_rrule(**kwargs)
9921003

9931004
def set(self, **kwargs):
1005+
"""Set parameters for an existing wrapper."""
9941006
self._construct.update(kwargs)
9951007

9961008
self._update_rrule(**self._construct)

0 commit comments

Comments
 (0)