@@ -301,6 +301,29 @@ def test_unsorted_index(self):
301
301
rs = Series (rs [:, 1 ], rs [:, 0 ], dtype = np .int64 , name = 'y' )
302
302
tm .assert_series_equal (rs , df .y )
303
303
304
+ def test_unsorted_index_lims (self ):
305
+ df = DataFrame ({'y' : [0. , 1. , 2. , 3. ]}, index = [1. , 0. , 3. , 2. ])
306
+ ax = df .plot ()
307
+ xmin , xmax = ax .get_xlim ()
308
+ lines = ax .get_lines ()
309
+ assert xmin <= np .nanmin (lines [0 ].get_data ()[0 ])
310
+ assert xmax >= np .nanmax (lines [0 ].get_data ()[0 ])
311
+
312
+ df = DataFrame ({'y' : [0. , 1. , np .nan , 3. , 4. , 5. , 6. ]},
313
+ index = [1. , 0. , 3. , 2. , np .nan , 3. , 2. ])
314
+ ax = df .plot ()
315
+ xmin , xmax = ax .get_xlim ()
316
+ lines = ax .get_lines ()
317
+ assert xmin <= np .nanmin (lines [0 ].get_data ()[0 ])
318
+ assert xmax >= np .nanmax (lines [0 ].get_data ()[0 ])
319
+
320
+ df = DataFrame ({'y' : [0. , 1. , 2. , 3. ], 'z' : [91. , 90. , 93. , 92. ]})
321
+ ax = df .plot (x = 'z' , y = 'y' )
322
+ xmin , xmax = ax .get_xlim ()
323
+ lines = ax .get_lines ()
324
+ assert xmin <= np .nanmin (lines [0 ].get_data ()[0 ])
325
+ assert xmax >= np .nanmax (lines [0 ].get_data ()[0 ])
326
+
304
327
@slow
305
328
def test_subplots (self ):
306
329
df = DataFrame (np .random .rand (10 , 3 ),
0 commit comments