2222 _check_ticks_props ,
2323 _check_visible ,
2424)
25+ from pandas .util .version import Version
2526
2627from pandas .io .formats .printing import pprint_thing
2728
@@ -35,6 +36,17 @@ def _check_ax_limits(col, ax):
3536 assert y_max >= col .max ()
3637
3738
39+ if Version (mpl ._version__ ) < Version ("3.10" ):
40+ verts = [{"vert" : False }, {"vert" : True }]
41+ else :
42+ verts = [{"orientation" : "horizontal" }, {"orientation" : "vertical" }]
43+
44+
45+ @pytest .fixture (params = verts )
46+ def vert (request ):
47+ return request .param
48+
49+
3850class TestDataFramePlots :
3951 def test_stacked_boxplot_set_axis (self ):
4052 # GH2980
@@ -312,7 +324,6 @@ def test_specified_props_kwd(self, props, expected):
312324
313325 assert result [expected ][0 ].get_color () == "C1"
314326
315- @pytest .mark .parametrize ("vert" , [True , False ])
316327 def test_plot_xlabel_ylabel (self , vert ):
317328 df = DataFrame (
318329 {
@@ -322,11 +333,10 @@ def test_plot_xlabel_ylabel(self, vert):
322333 }
323334 )
324335 xlabel , ylabel = "x" , "y"
325- ax = df .plot (kind = "box" , vert = vert , xlabel = xlabel , ylabel = ylabel )
336+ ax = df .plot (kind = "box" , xlabel = xlabel , ylabel = ylabel , ** vert )
326337 assert ax .get_xlabel () == xlabel
327338 assert ax .get_ylabel () == ylabel
328339
329- @pytest .mark .parametrize ("vert" , [True , False ])
330340 def test_plot_box (self , vert ):
331341 # GH 54941
332342 rng = np .random .default_rng (2 )
@@ -335,13 +345,12 @@ def test_plot_box(self, vert):
335345
336346 xlabel , ylabel = "x" , "y"
337347 _ , axs = plt .subplots (ncols = 2 , figsize = (10 , 7 ), sharey = True )
338- df1 .plot .box (ax = axs [0 ], vert = vert , xlabel = xlabel , ylabel = ylabel )
339- df2 .plot .box (ax = axs [1 ], vert = vert , xlabel = xlabel , ylabel = ylabel )
348+ df1 .plot .box (ax = axs [0 ], xlabel = xlabel , ylabel = ylabel , ** vert )
349+ df2 .plot .box (ax = axs [1 ], xlabel = xlabel , ylabel = ylabel , ** vert )
340350 for ax in axs :
341351 assert ax .get_xlabel () == xlabel
342352 assert ax .get_ylabel () == ylabel
343353
344- @pytest .mark .parametrize ("vert" , [True , False ])
345354 def test_boxplot_xlabel_ylabel (self , vert ):
346355 df = DataFrame (
347356 {
@@ -351,11 +360,10 @@ def test_boxplot_xlabel_ylabel(self, vert):
351360 }
352361 )
353362 xlabel , ylabel = "x" , "y"
354- ax = df .boxplot (vert = vert , xlabel = xlabel , ylabel = ylabel )
363+ ax = df .boxplot (xlabel = xlabel , ylabel = ylabel , ** vert )
355364 assert ax .get_xlabel () == xlabel
356365 assert ax .get_ylabel () == ylabel
357366
358- @pytest .mark .parametrize ("vert" , [True , False ])
359367 def test_boxplot_group_xlabel_ylabel (self , vert ):
360368 df = DataFrame (
361369 {
@@ -365,7 +373,7 @@ def test_boxplot_group_xlabel_ylabel(self, vert):
365373 }
366374 )
367375 xlabel , ylabel = "x" , "y"
368- ax = df .boxplot (by = "group" , vert = vert , xlabel = xlabel , ylabel = ylabel )
376+ ax = df .boxplot (by = "group" , xlabel = xlabel , ylabel = ylabel , ** vert )
369377 for subplot in ax :
370378 assert subplot .get_xlabel () == xlabel
371379 assert subplot .get_ylabel () == ylabel
0 commit comments