@@ -77,17 +77,17 @@ def test_date_empty():
77
77
ax .xaxis_date ()
78
78
fig .draw_without_rendering ()
79
79
np .testing .assert_allclose (ax .get_xlim (),
80
- [mdates .date2num (np .datetime64 ('2000 -01-01' )),
81
- mdates .date2num (np .datetime64 ('2010 -01-01 ' ))])
80
+ [mdates .date2num (np .datetime64 ('1970 -01-01' )),
81
+ mdates .date2num (np .datetime64 ('1970 -01-02 ' ))])
82
82
83
83
mdates ._reset_epoch_test_example ()
84
84
mdates .set_epoch ('0000-12-31' )
85
85
fig , ax = plt .subplots ()
86
86
ax .xaxis_date ()
87
87
fig .draw_without_rendering ()
88
88
np .testing .assert_allclose (ax .get_xlim (),
89
- [mdates .date2num (np .datetime64 ('2000 -01-01' )),
90
- mdates .date2num (np .datetime64 ('2010 -01-01 ' ))])
89
+ [mdates .date2num (np .datetime64 ('1970 -01-01' )),
90
+ mdates .date2num (np .datetime64 ('1970 -01-02 ' ))])
91
91
mdates ._reset_epoch_test_example ()
92
92
93
93
@@ -1235,7 +1235,7 @@ def test_julian2num():
1235
1235
def test_DateLocator ():
1236
1236
locator = mdates .DateLocator ()
1237
1237
# Test nonsingular
1238
- assert locator .nonsingular (0 , np .inf ) == (10957. 0 , 14610.0 )
1238
+ assert locator .nonsingular (0 , np .inf ) == (0 , 1 )
1239
1239
assert locator .nonsingular (0 , 1 ) == (0 , 1 )
1240
1240
assert locator .nonsingular (1 , 0 ) == (0 , 1 )
1241
1241
assert locator .nonsingular (0 , 0 ) == (- 2 , 2 )
@@ -1328,3 +1328,15 @@ def test_usetex_newline():
1328
1328
fig , ax = plt .subplots ()
1329
1329
ax .xaxis .set_major_formatter (mdates .DateFormatter ('%d/%m\n %Y' ))
1330
1330
fig .canvas .draw ()
1331
+
1332
+
1333
+ def test_datetime_masked ():
1334
+ # make sure that all-masked data falls back to the viewlim
1335
+ # set in convert.axisinfo....
1336
+ x = np .array ([datetime .datetime (2017 , 1 , n ) for n in range (1 , 6 )])
1337
+ y = np .array ([1 , 2 , 3 , 4 , 5 ])
1338
+ m = np .ma .masked_greater (y , 0 )
1339
+
1340
+ fig , ax = plt .subplots ()
1341
+ ax .plot (x , m )
1342
+ assert ax .get_xlim () == (0 , 1 )
0 commit comments