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

Skip to content

Commit 2aadcba

Browse files
committed
DOC: expand section on dates
1 parent 2287cac commit 2aadcba

1 file changed

Lines changed: 51 additions & 7 deletions

File tree

doc/users/dflt_style_changes.rst

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -892,15 +892,59 @@ Z-order
892892

893893

894894

895-
Dates
896-
=====
895+
`~matplotlib.dates.AutoDateFormatter` format strings
896+
====================================================
897+
898+
The default date formats are now all based on ISO format, i.e., with
899+
the slowest-moving value first. The date formatters are
900+
configurable through the ``date.autoformatter.*`` rcParams.
901+
902+
903+
+--------------------------------------+--------------------------------------+-------------------+-------------------+
904+
| Threshold (used if range > than) | rcParam | classic | v2.0 |
905+
+======================================+======================================+===================+===================+
906+
| days per year (365) | ``'date.autoformatter.year'`` | ``'%Y'`` | ``'%Y'`` |
907+
+--------------------------------------+--------------------------------------+-------------------+-------------------+
908+
| days per month (30) | ``'date.autoformatter.month'`` | ``'%b %Y'`` | ``'%Y-%m'`` |
909+
+--------------------------------------+--------------------------------------+-------------------+-------------------+
910+
| 1 day | ``'date.autoformatter.day'`` | ``'%b %d %Y'`` | ``'%Y-%m-%d'`` |
911+
+--------------------------------------+--------------------------------------+-------------------+-------------------+
912+
| 1 / hours per day | ``'date.autoformatter.hour'`` | ``'%H:%M:%S'`` | ``'%H:%M'`` |
913+
+--------------------------------------+--------------------------------------+-------------------+-------------------+
914+
| 1 / minutes per day | ``'date.autoformatter.minute'`` | ``'%H:%M:%S.%f'`` | ``'%H:%M:%S'`` |
915+
+--------------------------------------+--------------------------------------+-------------------+-------------------+
916+
| 1 / seconds per day | ``'date.autoformatter.second'`` | ``'%H:%M:%S.%f'`` | ``'%H:%M:%S'`` |
917+
+--------------------------------------+--------------------------------------+-------------------+-------------------+
918+
| 1 / microseconds per day | ``'date.autoformatter.microsecond'`` | ``'%H:%M:%S.%f'`` | ``'%H:%M:%S.%f'`` |
919+
+--------------------------------------+--------------------------------------+-------------------+-------------------+
920+
921+
922+
923+
Python's ``%x`` and ``%X`` date formats may be of particular interest
924+
to format dates based on the current locale.
897925

898-
- The default date formats are now all based on ISO format, i.e., with
899-
the slowest-moving value first. The date formatters are still
900-
changeable through the ``date.autoformatter.*`` rcParams. Python's
901-
``%x`` and ``%X`` date formats may be of particular interest to
902-
format dates based on the current locale.
926+
The previous default can be restored by::
903927

928+
mpl.rcParams['date.autoformatter.year'] = '%Y'
929+
mpl.rcParams['date.autoformatter.month'] = '%b %Y'
930+
mpl.rcParams['date.autoformatter.day'] = '%b %d %Y'
931+
mpl.rcParams['date.autoformatter.hour'] = '%H:%M:%S'
932+
mpl.rcParams['date.autoformatter.minute'] = '%H:%M:%S.%f'
933+
mpl.rcParams['date.autoformatter.second'] = '%H:%M:%S.%f'
934+
mpl.rcParams['date.autoformatter.microsecond'] = '%H:%M:%S.%f'
935+
936+
937+
or setting ::
938+
939+
date.autoformatter.year : %Y
940+
date.autoformatter.month : %b %Y
941+
date.autoformatter.day : %b %d %Y
942+
date.autoformatter.hour : %H:%M:%S
943+
date.autoformatter.minute : %H:%M:%S.%f
944+
date.autoformatter.second : %H:%M:%S.%f
945+
date.autoformatter.microsecond : %H:%M:%S.%f
946+
947+
in your :file:`matplotlibrc` file.
904948

905949
mplot3d
906950
=======

0 commit comments

Comments
 (0)