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