Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bac91f5

Browse files
authored
Merge pull request #19600 from jklymak/doc-more-dates
DOC: better intro for dates.py
2 parents b7d57c9 + d16b1dd commit bac91f5

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

lib/matplotlib/dates.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,28 @@
22
Matplotlib provides sophisticated date plotting capabilities, standing on the
33
shoulders of python :mod:`datetime` and the add-on module :mod:`dateutil`.
44
5+
By default, Matplotlib uses the units machinery described in
6+
`~matplotlib.units` to convert `datetime.datetime`, and `numpy.datetime64`
7+
objects when plotted on an x- or y-axis. The user does not
8+
need to do anything for dates to be formatted, but dates often have strict
9+
formatting needs, so this module provides many axis locators and formatters.
10+
A basic example using `numpy.datetime64` is::
11+
12+
import numpy as np
13+
14+
times = np.arange(np.datetime64('2001-01-02'),
15+
np.datetime64('2002-02-03'), np.timedelta64(75, 'm'))
16+
y = np.random.randn(len(times))
17+
18+
fig, ax = plt.subplots()
19+
ax.plot(times, y)
20+
21+
.. seealso::
22+
23+
- :doc:`/gallery/text_labels_and_annotations/date`
24+
- :doc:`/gallery/ticks_and_spines/date_concise_formatter`
25+
- :doc:`/gallery/ticks_and_spines/date_demo_convert`
26+
527
.. _date-format:
628
729
Matplotlib date format

0 commit comments

Comments
 (0)