Skip to content

Commit d7739f3

Browse files
committed
FIX
1 parent cc1815b commit d7739f3

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/matplotlib/axis.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1915,6 +1915,7 @@ def axis_date(self, tz=None):
19151915
import dateutil.tz
19161916
tz = dateutil.tz.gettz(tz)
19171917
self.update_units(datetime.datetime(2009, 1, 1, 0, 0, 0, 0, tz))
1918+
self.set_default_intervals()
19181919

19191920
def get_tick_space(self):
19201921
"""Return the estimated number of ticks that can fit on the axis."""

lib/matplotlib/tests/test_dates.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,27 @@ def test_date2num_NaT_scalar(units):
6969
assert np.isnan(tmpl)
7070

7171

72-
@image_comparison(['date_empty.png'])
7372
def test_date_empty():
7473
# make sure we do the right thing when told to plot dates even
7574
# if no date data has been presented, cf
7675
# http://sourceforge.net/tracker/?func=detail&aid=2850075&group_id=80706&atid=560720
7776
fig, ax = plt.subplots()
7877
ax.xaxis_date()
78+
fig.draw_no_output()
79+
np.testing.assert_allclose(ax.get_xlim(),
80+
[mdates.date2num(np.datetime64('2000-01-01')),
81+
mdates.date2num(np.datetime64('2010-01-01'))])
82+
83+
mdates._reset_epoch_test_example()
84+
mdates.set_epoch('0000-12-31')
85+
fig, ax = plt.subplots()
86+
ax.xaxis_date()
87+
fig.draw_no_output()
88+
np.testing.assert_allclose(ax.get_xlim(),
89+
[mdates.date2num(np.datetime64('2000-01-01')),
90+
mdates.date2num(np.datetime64('2010-01-01'))])
91+
mdates._reset_epoch_test_example()
92+
7993

8094

8195
@image_comparison(['date_axhspan.png'])

0 commit comments

Comments
 (0)