Skip to content

Cleanup dates docstrings. #16951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 14 additions & 24 deletions lib/matplotlib/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Matplotlib provides sophisticated date plotting capabilities, standing on the
shoulders of python :mod:`datetime` and the add-on module :mod:`dateutil`.


.. _date-format:

Matplotlib date format
Expand Down Expand Up @@ -62,8 +61,7 @@
Date tickers
------------

Most of the date tickers can locate single or multiple values. For
example::
Most of the date tickers can locate single or multiple values. For example::

# import constants for the days of the week
from matplotlib.dates import MO, TU, WE, TH, FR, SA, SU
Expand All @@ -87,23 +85,23 @@

The available date tickers are:

* `MicrosecondLocator`: locate microseconds
* `MicrosecondLocator`: Locate microseconds.

* `SecondLocator`: locate seconds
* `SecondLocator`: Locate seconds.

* `MinuteLocator`: locate minutes
* `MinuteLocator`: Locate minutes.

* `HourLocator`: locate hours
* `HourLocator`: Locate hours.

* `DayLocator`: locate specified days of the month
* `DayLocator`: Locate specified days of the month.

* `WeekdayLocator`: Locate days of the week, e.g., MO, TU
* `WeekdayLocator`: Locate days of the week, e.g., MO, TU.

* `MonthLocator`: locate months, e.g., 7 for july
* `MonthLocator`: Locate months, e.g., 7 for July.

* `YearLocator`: locate years that are multiples of base
* `YearLocator`: Locate years that are multiples of base.

* `RRuleLocator`: locate using a `matplotlib.dates.rrulewrapper`.
* `RRuleLocator`: Locate using a `matplotlib.dates.rrulewrapper`.
`.rrulewrapper` is a simple wrapper around dateutil_'s `dateutil.rrule` which
allow almost arbitrary date tick specifications. See :doc:`rrule example
</gallery/ticks_and_spines/date_demo_rrule>`.
Expand Down Expand Up @@ -208,7 +206,7 @@ def _to_ordinalf(dt):
"""
Convert :mod:`datetime` or :mod:`date` to the Gregorian date as UTC float
days, preserving hours, minutes, seconds and microseconds. Return value
is a :func:`float`.
is a `float`.
"""
# Convert to UTC
tzi = getattr(dt, 'tzinfo', None)
Expand Down Expand Up @@ -1093,10 +1091,7 @@ def tick_values(self, vmin, vmax):
return self.raise_if_exceeds(date2num(dates))

def _get_unit(self):
"""
Return how many days a unit of the locator is; used for
intelligent autoscaling.
"""
# docstring inherited
freq = self.rule._rrule._freq
return self.get_unit_generic(freq)

Expand Down Expand Up @@ -1679,16 +1674,11 @@ def tick_values(self, vmin, vmax):
return ticks

def _get_unit(self):
"""
Return how many days a unit of the locator is; used for
intelligent autoscaling.
"""
# docstring inherited
return 1. / MUSECONDS_PER_DAY

def _get_interval(self):
"""
Return the number of units for each tick.
"""
# docstring inherited
return self._interval


Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy