File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 2
2
Matplotlib provides sophisticated date plotting capabilities, standing on the
3
3
shoulders of python :mod:`datetime` and the add-on module :mod:`dateutil`.
4
4
5
+ By default, Matpltolib 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. By default, 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
+ However, a basic example using `numpy.datetime64` is::
11
+
12
+ import numpy as np
13
+ fig, ax = plt.subplots()
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
+ ax.plot(times, y)
18
+
19
+ .. seealso::
20
+
21
+ - :doc:`/gallery/text_labels_and_annotations/date`
22
+ - :doc:`/gallery/ticks_and_spines/date_concise_formatter`
23
+ - :doc:`/gallery/ticks_and_spines/date_demo_convert`
24
+
5
25
.. _date-format:
6
26
7
27
Matplotlib date format
You can’t perform that action at this time.
0 commit comments