@@ -161,22 +161,22 @@ def test_plot_fails_when_ax_differs_from_figure(self):
161161 @slow
162162 def test_autocorrelation_plot (self ):
163163 from pandas .tools .plotting import autocorrelation_plot
164- _check_plot_works (autocorrelation_plot , self .ts )
165- _check_plot_works (autocorrelation_plot , self .ts .values )
164+ _check_plot_works (autocorrelation_plot , series = self .ts )
165+ _check_plot_works (autocorrelation_plot , series = self .ts .values )
166166
167167 ax = autocorrelation_plot (self .ts , label = 'Test' )
168168 self ._check_legend_labels (ax , labels = ['Test' ])
169169
170170 @slow
171171 def test_lag_plot (self ):
172172 from pandas .tools .plotting import lag_plot
173- _check_plot_works (lag_plot , self .ts )
174- _check_plot_works (lag_plot , self .ts , lag = 5 )
173+ _check_plot_works (lag_plot , series = self .ts )
174+ _check_plot_works (lag_plot , series = self .ts , lag = 5 )
175175
176176 @slow
177177 def test_bootstrap_plot (self ):
178178 from pandas .tools .plotting import bootstrap_plot
179- _check_plot_works (bootstrap_plot , self .ts , size = 10 )
179+ _check_plot_works (bootstrap_plot , series = self .ts , size = 10 )
180180
181181
182182@tm .mplskip
@@ -210,7 +210,7 @@ def test_boxplot_legacy(self):
210210 _check_plot_works (df .boxplot , column = 'one' , by = ['indic' , 'indic2' ])
211211 _check_plot_works (df .boxplot , by = 'indic' )
212212 _check_plot_works (df .boxplot , by = ['indic' , 'indic2' ])
213- _check_plot_works (plotting .boxplot , df ['one' ], return_type = 'dict' )
213+ _check_plot_works (plotting .boxplot , data = df ['one' ], return_type = 'dict' )
214214 _check_plot_works (df .boxplot , notch = 1 , return_type = 'dict' )
215215 _check_plot_works (df .boxplot , by = 'indic' , notch = 1 )
216216
@@ -304,6 +304,7 @@ def test_boxplot_empty_column(self):
304304
305305 @slow
306306 def test_hist_df_legacy (self ):
307+ from matplotlib .patches import Rectangle
307308 _check_plot_works (self .hist_df .hist )
308309
309310 # make sure layout is handled
@@ -347,7 +348,8 @@ def test_hist_df_legacy(self):
347348 # make sure kwargs to hist are handled
348349 ax = ser .hist (normed = True , cumulative = True , bins = 4 )
349350 # height of last bin (index 5) must be 1.0
350- self .assertAlmostEqual (ax .get_children ()[5 ].get_height (), 1.0 )
351+ rects = [x for x in ax .get_children () if isinstance (x , Rectangle )]
352+ self .assertAlmostEqual (rects [- 1 ].get_height (), 1.0 )
351353
352354 tm .close ()
353355 ax = ser .hist (log = True )
@@ -413,9 +415,9 @@ def scat(**kwds):
413415 def scat2 (x , y , by = None , ax = None , figsize = None ):
414416 return plotting .scatter_plot (df , x , y , by , ax , figsize = None )
415417
416- _check_plot_works (scat2 , 0 , 1 )
418+ _check_plot_works (scat2 , x = 0 , y = 1 )
417419 grouper = Series (np .repeat ([1 , 2 , 3 , 4 , 5 ], 20 ), df .index )
418- _check_plot_works (scat2 , 0 , 1 , by = grouper )
420+ _check_plot_works (scat2 , x = 0 , y = 1 , by = grouper )
419421
420422 def test_scatter_matrix_axis (self ):
421423 tm ._skip_if_no_scipy ()
@@ -424,15 +426,17 @@ def test_scatter_matrix_axis(self):
424426 with tm .RNGContext (42 ):
425427 df = DataFrame (randn (100 , 3 ))
426428
427- axes = _check_plot_works (scatter_matrix , df , range_padding = .1 )
429+ axes = _check_plot_works (scatter_matrix , filterwarnings = 'always' , frame = df ,
430+ range_padding = .1 )
428431 axes0_labels = axes [0 ][0 ].yaxis .get_majorticklabels ()
429432 # GH 5662
430433 expected = ['-2' , '-1' , '0' , '1' , '2' ]
431434 self ._check_text_labels (axes0_labels , expected )
432435 self ._check_ticks_props (axes , xlabelsize = 8 , xrot = 90 , ylabelsize = 8 , yrot = 0 )
433436
434437 df [0 ] = ((df [0 ] - 2 ) / 3 )
435- axes = _check_plot_works (scatter_matrix , df , range_padding = .1 )
438+ axes = _check_plot_works (scatter_matrix , filterwarnings = 'always' , frame = df ,
439+ range_padding = .1 )
436440 axes0_labels = axes [0 ][0 ].yaxis .get_majorticklabels ()
437441 expected = ['-1.2' , '-1.0' , '-0.8' , '-0.6' , '-0.4' , '-0.2' , '0.0' ]
438442 self ._check_text_labels (axes0_labels , expected )
@@ -445,17 +449,17 @@ def test_andrews_curves(self):
445449
446450 df = self .iris
447451
448- _check_plot_works (andrews_curves , df , 'Name' )
452+ _check_plot_works (andrews_curves , frame = df , class_column = 'Name' )
449453
450454 rgba = ('#556270' , '#4ECDC4' , '#C7F464' )
451- ax = _check_plot_works (andrews_curves , df , 'Name' , color = rgba )
455+ ax = _check_plot_works (andrews_curves , frame = df , class_column = 'Name' , color = rgba )
452456 self ._check_colors (ax .get_lines ()[:10 ], linecolors = rgba , mapping = df ['Name' ][:10 ])
453457
454458 cnames = ['dodgerblue' , 'aquamarine' , 'seagreen' ]
455- ax = _check_plot_works (andrews_curves , df , 'Name' , color = cnames )
459+ ax = _check_plot_works (andrews_curves , frame = df , class_column = 'Name' , color = cnames )
456460 self ._check_colors (ax .get_lines ()[:10 ], linecolors = cnames , mapping = df ['Name' ][:10 ])
457461
458- ax = _check_plot_works (andrews_curves , df , 'Name' , colormap = cm .jet )
462+ ax = _check_plot_works (andrews_curves , frame = df , class_column = 'Name' , colormap = cm .jet )
459463 cmaps = lmap (cm .jet , np .linspace (0 , 1 , df ['Name' ].nunique ()))
460464 self ._check_colors (ax .get_lines ()[:10 ], linecolors = cmaps , mapping = df ['Name' ][:10 ])
461465
@@ -478,23 +482,23 @@ def test_parallel_coordinates(self):
478482
479483 df = self .iris
480484
481- ax = _check_plot_works (parallel_coordinates , df , 'Name' )
485+ ax = _check_plot_works (parallel_coordinates , frame = df , class_column = 'Name' )
482486 nlines = len (ax .get_lines ())
483487 nxticks = len (ax .xaxis .get_ticklabels ())
484488
485489 rgba = ('#556270' , '#4ECDC4' , '#C7F464' )
486- ax = _check_plot_works (parallel_coordinates , df , 'Name' , color = rgba )
490+ ax = _check_plot_works (parallel_coordinates , frame = df , class_column = 'Name' , color = rgba )
487491 self ._check_colors (ax .get_lines ()[:10 ], linecolors = rgba , mapping = df ['Name' ][:10 ])
488492
489493 cnames = ['dodgerblue' , 'aquamarine' , 'seagreen' ]
490- ax = _check_plot_works (parallel_coordinates , df , 'Name' , color = cnames )
494+ ax = _check_plot_works (parallel_coordinates , frame = df , class_column = 'Name' , color = cnames )
491495 self ._check_colors (ax .get_lines ()[:10 ], linecolors = cnames , mapping = df ['Name' ][:10 ])
492496
493- ax = _check_plot_works (parallel_coordinates , df , 'Name' , colormap = cm .jet )
497+ ax = _check_plot_works (parallel_coordinates , frame = df , class_column = 'Name' , colormap = cm .jet )
494498 cmaps = lmap (cm .jet , np .linspace (0 , 1 , df ['Name' ].nunique ()))
495499 self ._check_colors (ax .get_lines ()[:10 ], linecolors = cmaps , mapping = df ['Name' ][:10 ])
496500
497- ax = _check_plot_works (parallel_coordinates , df , 'Name' , axvlines = False )
501+ ax = _check_plot_works (parallel_coordinates , frame = df , class_column = 'Name' , axvlines = False )
498502 assert len (ax .get_lines ()) == (nlines - nxticks )
499503
500504 colors = ['b' , 'g' , 'r' ]
@@ -517,20 +521,20 @@ def test_radviz(self):
517521 from matplotlib import cm
518522
519523 df = self .iris
520- _check_plot_works (radviz , df , 'Name' )
524+ _check_plot_works (radviz , frame = df , class_column = 'Name' )
521525
522526 rgba = ('#556270' , '#4ECDC4' , '#C7F464' )
523- ax = _check_plot_works (radviz , df , 'Name' , color = rgba )
527+ ax = _check_plot_works (radviz , frame = df , class_column = 'Name' , color = rgba )
524528 # skip Circle drawn as ticks
525529 patches = [p for p in ax .patches [:20 ] if p .get_label () != '' ]
526530 self ._check_colors (patches [:10 ], facecolors = rgba , mapping = df ['Name' ][:10 ])
527531
528532 cnames = ['dodgerblue' , 'aquamarine' , 'seagreen' ]
529- _check_plot_works (radviz , df , 'Name' , color = cnames )
533+ _check_plot_works (radviz , frame = df , class_column = 'Name' , color = cnames )
530534 patches = [p for p in ax .patches [:20 ] if p .get_label () != '' ]
531535 self ._check_colors (patches , facecolors = cnames , mapping = df ['Name' ][:10 ])
532536
533- _check_plot_works (radviz , df , 'Name' , colormap = cm .jet )
537+ _check_plot_works (radviz , frame = df , class_column = 'Name' , colormap = cm .jet )
534538 cmaps = lmap (cm .jet , np .linspace (0 , 1 , df ['Name' ].nunique ()))
535539 patches = [p for p in ax .patches [:20 ] if p .get_label () != '' ]
536540 self ._check_colors (patches , facecolors = cmaps , mapping = df ['Name' ][:10 ])
@@ -607,6 +611,8 @@ def test_grouped_plot_fignums(self):
607611
608612 @slow
609613 def test_grouped_hist_legacy (self ):
614+ from matplotlib .patches import Rectangle
615+
610616 df = DataFrame (randn (500 , 2 ), columns = ['A' , 'B' ])
611617 df ['C' ] = np .random .randint (0 , 4 , 500 )
612618 df ['D' ] = ['X' ] * 500
@@ -633,7 +639,8 @@ def test_grouped_hist_legacy(self):
633639 xlabelsize = xf , xrot = xrot , ylabelsize = yf , yrot = yrot )
634640 # height of last bin (index 5) must be 1.0
635641 for ax in axes .ravel ():
636- height = ax .get_children ()[5 ].get_height ()
642+ rects = [x for x in ax .get_children () if isinstance (x , Rectangle )]
643+ height = rects [- 1 ].get_height ()
637644 self .assertAlmostEqual (height , 1.0 )
638645 self ._check_ticks_props (axes , xlabelsize = xf , xrot = xrot ,
639646 ylabelsize = yf , yrot = yrot )
0 commit comments