|
9 | 9 | ----------------------
|
10 | 10 | Matplotlib represents dates using floating point numbers specifying the number
|
11 | 11 | of days since 0001-01-01 UTC, plus 1. For example, 0001-01-01, 06:00 is 1.25,
|
12 |
| -not 0.25. Values < 1, i.e. dates before 0001-01-01 UTC are not supported. |
| 12 | +not 0.25. Values < 1, i.e. dates before 0001-01-01 UTC, are not supported. |
13 | 13 |
|
14 | 14 | There are a number of helper functions to convert between :mod:`datetime`
|
15 | 15 | objects and Matplotlib dates:
|
|
44 | 44 | Out[1]: 732401
|
45 | 45 |
|
46 | 46 | All the Matplotlib date converters, tickers and formatters are timezone aware.
|
47 |
| -If no explicit timezone is provided, the rcParam ``timezone`` is assumed. If |
48 |
| -you want to use a custom time zone, pass a :class:`datetime.tzinfo` instance |
49 |
| -with the tz keyword argument to :func:`num2date`, :func:`.plot_date`, and any |
50 |
| -custom date tickers or locators you create. |
| 47 | +If no explicit timezone is provided, :rc:`timezone` is assumed. If you want to |
| 48 | +use a custom time zone, pass a `datetime.tzinfo` instance with the tz keyword |
| 49 | +argument to `num2date`, `~.Axes.plot_date`, and any custom date tickers or |
| 50 | +locators you create. |
51 | 51 |
|
52 | 52 | A wide range of specific and general purpose date tick locators and
|
53 | 53 | formatters are provided in this module. See
|
|
85 | 85 | rule = rrulewrapper(YEARLY, byeaster=1, interval=5)
|
86 | 86 | loc = RRuleLocator(rule)
|
87 | 87 |
|
88 |
| -Here are all the date tickers: |
| 88 | +The available date tickers are: |
89 | 89 |
|
90 |
| - * :class:`MicrosecondLocator`: locate microseconds |
| 90 | +* `MicrosecondLocator`: locate microseconds |
91 | 91 |
|
92 |
| - * :class:`SecondLocator`: locate seconds |
| 92 | +* `SecondLocator`: locate seconds |
93 | 93 |
|
94 |
| - * :class:`MinuteLocator`: locate minutes |
| 94 | +* `MinuteLocator`: locate minutes |
95 | 95 |
|
96 |
| - * :class:`HourLocator`: locate hours |
| 96 | +* `HourLocator`: locate hours |
97 | 97 |
|
98 |
| - * :class:`DayLocator`: locate specified days of the month |
| 98 | +* `DayLocator`: locate specified days of the month |
99 | 99 |
|
100 |
| - * :class:`WeekdayLocator`: Locate days of the week, e.g., MO, TU |
| 100 | +* `WeekdayLocator`: Locate days of the week, e.g., MO, TU |
101 | 101 |
|
102 |
| - * :class:`MonthLocator`: locate months, e.g., 7 for july |
| 102 | +* `MonthLocator`: locate months, e.g., 7 for july |
103 | 103 |
|
104 |
| - * :class:`YearLocator`: locate years that are multiples of base |
| 104 | +* `YearLocator`: locate years that are multiples of base |
105 | 105 |
|
106 |
| - * :class:`RRuleLocator`: locate using a `matplotlib.dates.rrulewrapper`. |
107 |
| - `.rrulewrapper` is a simple wrapper around dateutil_'s `dateutil.rrule` |
108 |
| - which allow almost arbitrary date tick specifications. See :doc:`rrule |
109 |
| - example </gallery/ticks_and_spines/date_demo_rrule>`. |
| 106 | +* `RRuleLocator`: locate using a `matplotlib.dates.rrulewrapper`. |
| 107 | + `.rrulewrapper` is a simple wrapper around dateutil_'s `dateutil.rrule` which |
| 108 | + allow almost arbitrary date tick specifications. See :doc:`rrule example |
| 109 | + </gallery/ticks_and_spines/date_demo_rrule>`. |
110 | 110 |
|
111 |
| - * :class:`AutoDateLocator`: On autoscale, this class picks the best |
112 |
| - :class:`DateLocator` (e.g., :class:`RRuleLocator`) |
113 |
| - to set the view limits and the tick |
114 |
| - locations. If called with ``interval_multiples=True`` it will |
115 |
| - make ticks line up with sensible multiples of the tick intervals. E.g. |
116 |
| - if the interval is 4 hours, it will pick hours 0, 4, 8, etc as ticks. |
117 |
| - This behaviour is not guaranteed by default. |
| 111 | +* `AutoDateLocator`: On autoscale, this class picks the best `DateLocator` |
| 112 | + (e.g., `RRuleLocator`) to set the view limits and the tick locations. If |
| 113 | + called with ``interval_multiples=True`` it will make ticks line up with |
| 114 | + sensible multiples of the tick intervals. E.g. if the interval is 4 hours, |
| 115 | + it will pick hours 0, 4, 8, etc as ticks. This behaviour is not guaranteed |
| 116 | + by default. |
118 | 117 |
|
119 | 118 | Date formatters
|
120 | 119 | ---------------
|
121 | 120 |
|
122 |
| -Here all all the date formatters: |
| 121 | +The available date formatters are: |
123 | 122 |
|
124 |
| - * :class:`AutoDateFormatter`: attempts to figure out the best format |
125 |
| - to use. This is most useful when used with the :class:`AutoDateLocator`. |
| 123 | +* `AutoDateFormatter`: attempts to figure out the best format to use. This is |
| 124 | + most useful when used with the `AutoDateLocator`. |
126 | 125 |
|
127 |
| - * :class:`ConciseDateFormatter`: also attempts to figure out the best |
128 |
| - format to use, and to make the format as compact as possible while |
129 |
| - still having complete date information. This is most useful when used |
130 |
| - with the :class:`AutoDateLocator`. |
| 126 | +* `ConciseDateFormatter`: also attempts to figure out the best format to use, |
| 127 | + and to make the format as compact as possible while still having complete |
| 128 | + date information. This is most useful when used with the `AutoDateLocator`. |
131 | 129 |
|
132 |
| - * :class:`DateFormatter`: use :func:`strftime` format strings |
| 130 | +* `DateFormatter`: use `strftime` format strings. |
133 | 131 |
|
134 |
| - * :class:`IndexDateFormatter`: date plots with implicit *x* |
135 |
| - indexing. |
| 132 | +* `IndexDateFormatter`: date plots with implicit *x* indexing. |
136 | 133 | """
|
137 | 134 |
|
138 | 135 | import datetime
|
|
0 commit comments