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