|
113 | 113 | unicode_literals) |
114 | 114 |
|
115 | 115 | from matplotlib.externals import six |
116 | | -from matplotlib.externals.six.moves import xrange, zip |
117 | | - |
| 116 | +from matplotlib.externals.six.moves import zip |
| 117 | +from matplotlib import rcParams |
118 | 118 | import re |
119 | 119 | import time |
120 | 120 | import math |
@@ -629,12 +629,12 @@ class AutoDateFormatter(ticker.Formatter): |
629 | 629 | format string. The default looks like this:: |
630 | 630 |
|
631 | 631 | self.scaled = { |
632 | | - 365.0 : '%Y', |
633 | | - 30. : '%b %Y', |
634 | | - 1.0 : '%b %d %Y', |
635 | | - 1./24. : '%H:%M:%S', |
636 | | - 1. / (24. * 60.): '%H:%M:%S.%f', |
637 | | - } |
| 632 | + DAYS_PER_YEAR: rcParams['date.autoformat.year'], |
| 633 | + DAYS_PER_MONTH: rcParams['date.autoformat.month'], |
| 634 | + 1.0: rcParams['date.autoformat.day'], |
| 635 | + 1. / HOURS_PER_DAY: rcParams['date.autoformat.hour'], |
| 636 | + 1. / (MINUTES_PER_DAY): rcParams['date.autoformat.minute'], |
| 637 | + 1. / (SEC_PER_DAY): rcParams['date.autoformat.second']} |
638 | 638 |
|
639 | 639 |
|
640 | 640 | The algorithm picks the key in the dictionary that is >= the |
@@ -685,11 +685,14 @@ def __init__(self, locator, tz=None, defaultfmt='%Y-%m-%d'): |
685 | 685 | self._tz = tz |
686 | 686 | self.defaultfmt = defaultfmt |
687 | 687 | self._formatter = DateFormatter(self.defaultfmt, tz) |
688 | | - self.scaled = {DAYS_PER_YEAR: '%Y', |
689 | | - DAYS_PER_MONTH: '%b %Y', |
690 | | - 1.0: '%b %d %Y', |
691 | | - 1. / HOURS_PER_DAY: '%H:%M:%S', |
692 | | - 1. / (MINUTES_PER_DAY): '%H:%M:%S.%f'} |
| 688 | + self.scaled = {DAYS_PER_YEAR: rcParams['date.autoformatter.year'], |
| 689 | + DAYS_PER_MONTH: rcParams['date.autoformatter.month'], |
| 690 | + 1.0: rcParams['date.autoformatter.day'], |
| 691 | + 1. / HOURS_PER_DAY: rcParams['date.autoformatter.hour'], |
| 692 | + 1. / (MINUTES_PER_DAY): |
| 693 | + rcParams['date.autoformatter.minute'], |
| 694 | + 1. / (SEC_PER_DAY): |
| 695 | + rcParams['date.autoformatter.second']} |
693 | 696 |
|
694 | 697 | def __call__(self, x, pos=None): |
695 | 698 | locator_unit_scale = float(self._locator._get_unit()) |
|
0 commit comments