From d926cb008a1b162a56ecb75ef6ea9df9c024ac7a Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Mon, 7 Sep 2020 09:38:49 -0700 Subject: [PATCH 1/3] DOC: fix date example --- examples/text_labels_and_annotations/date.py | 26 ++++++++++++-------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/examples/text_labels_and_annotations/date.py b/examples/text_labels_and_annotations/date.py index b2aedebcbfb2..314493641c3c 100644 --- a/examples/text_labels_and_annotations/date.py +++ b/examples/text_labels_and_annotations/date.py @@ -7,16 +7,22 @@ formatters. See :doc:`/gallery/ticks_and_spines/major_minor_demo` for more information on controlling major and minor ticks. -All Matplotlib date plotting is done by converting date instances into -days since 0001-01-01 00:00:00 UTC plus one day (for historical reasons). -The conversion, tick locating and formatting is done behind the scenes -so this is most transparent to you. The :mod:`matplotlib.dates` module -provides the converter functions `.date2num` and `.num2date`, which convert -`datetime.datetime` and `numpy.datetime64` objects to and from Matplotlib's -internal representation. - -An alternative way of displaying dates can be seen at -:doc:`/gallery/ticks_and_spines/date_concise_formatter`. +Matplotlib date plotting is done by converting date instances into +days since an epoch (by default 1970-01-01T00:00:00). The +:mod:`matplotlib.dates` module provides the converter functions `.date2num` +and `.num2date`, which convert `datetime.datetime` and `numpy.datetime64` +objects to and from Matplotlib's internal representation. These data +types are "registered" with with the unit conversion mechanism described in +:mod:`matplotlib.units`, so the conversion happens automatically for the user. +The registration process also sets the default tick ``locator`` and +``formatter`` for the axis to be `~.matplotlib.dates.AutoDateLocator` and +`~.matplotlib.dates.AutoDateFormatter`. These can be changed manually with +`.axis.set_major_locator` and `.axis.set_major_formatter`; see for example +:doc:`/gallery/ticks_and_spines/date_demo_convert`. + +An alternative formatter is the `~.matplotlib.dates.ConciseDateFormatter` +as described at :doc:`/gallery/ticks_and_spines/date_concise_formatter`, +which often removes the need to rotate the tick labels. """ import numpy as np From 079f472670712f563ac4ab3f32dbdf5f9bd479f0 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 7 Sep 2020 13:24:32 -0400 Subject: [PATCH 2/3] DOC: correct cross-reference names --- examples/text_labels_and_annotations/date.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/text_labels_and_annotations/date.py b/examples/text_labels_and_annotations/date.py index 314493641c3c..7914659323c6 100644 --- a/examples/text_labels_and_annotations/date.py +++ b/examples/text_labels_and_annotations/date.py @@ -17,7 +17,7 @@ The registration process also sets the default tick ``locator`` and ``formatter`` for the axis to be `~.matplotlib.dates.AutoDateLocator` and `~.matplotlib.dates.AutoDateFormatter`. These can be changed manually with -`.axis.set_major_locator` and `.axis.set_major_formatter`; see for example +`.Axis.set_major_locator` and `.Axis.set_major_formatter`; see for example :doc:`/gallery/ticks_and_spines/date_demo_convert`. An alternative formatter is the `~.matplotlib.dates.ConciseDateFormatter` From 8929644f20ea8df9775defa093222f0919f3c26f Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Mon, 7 Sep 2020 15:08:47 -0700 Subject: [PATCH 3/3] Update examples/text_labels_and_annotations/date.py Co-authored-by: Thomas A Caswell --- examples/text_labels_and_annotations/date.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/text_labels_and_annotations/date.py b/examples/text_labels_and_annotations/date.py index 7914659323c6..41944fa2cc53 100644 --- a/examples/text_labels_and_annotations/date.py +++ b/examples/text_labels_and_annotations/date.py @@ -12,7 +12,7 @@ :mod:`matplotlib.dates` module provides the converter functions `.date2num` and `.num2date`, which convert `datetime.datetime` and `numpy.datetime64` objects to and from Matplotlib's internal representation. These data -types are "registered" with with the unit conversion mechanism described in +types are registered with with the unit conversion mechanism described in :mod:`matplotlib.units`, so the conversion happens automatically for the user. The registration process also sets the default tick ``locator`` and ``formatter`` for the axis to be `~.matplotlib.dates.AutoDateLocator` and