Skip to content

Commit 2db3ebc

Browse files
committed
STY: fix poor date-time format defaults
Without this change, zooming in from ticks separated by days to ticks separated by multiples of hours leaves tick labels with no date information, even when the time period covers several days. With the change there is a systematic progression from one level to the next, dropping the largest unit and adding a smaller unit.
1 parent 592e509 commit 2db3ebc

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/matplotlib/rcsetup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,10 +1135,10 @@ def validate_animation_writer_path(p):
11351135
'date.autoformatter.year': ['%Y', six.text_type],
11361136
'date.autoformatter.month': ['%Y-%m', six.text_type],
11371137
'date.autoformatter.day': ['%Y-%m-%d', six.text_type],
1138-
'date.autoformatter.hour': ['%H:%M', six.text_type],
1139-
'date.autoformatter.minute': ['%H:%M:%S', six.text_type],
1138+
'date.autoformatter.hour': ['%m-%d %H', six.text_type],
1139+
'date.autoformatter.minute': ['%d %H:%M', six.text_type],
11401140
'date.autoformatter.second': ['%H:%M:%S', six.text_type],
1141-
'date.autoformatter.microsecond': ['%H:%M:%S.%f', six.text_type],
1141+
'date.autoformatter.microsecond': ['%M:%S.%f', six.text_type],
11421142

11431143
#legend properties
11441144
'legend.fancybox': [True, validate_bool],

matplotlibrc.template

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,10 @@ backend : $TEMPLATE_BACKEND
363363
# date.autoformatter.year : %Y
364364
# date.autoformatter.month : %Y-%m
365365
# date.autoformatter.day : %Y-%m-%d
366-
# date.autoformatter.hour : %H:%M
367-
# date.autoformatter.minute : %H:%M:%S
366+
# date.autoformatter.hour : %m-%d %H
367+
# date.autoformatter.minute : %d %H:%M
368368
# date.autoformatter.second : %H:%M:%S
369-
# date.autoformatter.microsecond : %H:%M:%S.%f
369+
# date.autoformatter.microsecond : %M:%S.%f
370370

371371
### TICKS
372372
# see http://matplotlib.org/api/axis_api.html#matplotlib.axis.Tick

0 commit comments

Comments
 (0)