@@ -77,6 +77,9 @@ def setUp(self):
7777 else :
7878 self .bp_n_objects = 8
7979
80+ self .mpl_le_1_2_1 = str (mpl .__version__ ) <= LooseVersion ('1.2.1' )
81+ self .mpl_ge_1_3_1 = str (mpl .__version__ ) >= LooseVersion ('1.3.1' )
82+
8083 def tearDown (self ):
8184 tm .close ()
8285
@@ -443,7 +446,6 @@ def setUp(self):
443446 import matplotlib as mpl
444447 mpl .rcdefaults ()
445448
446- self .mpl_le_1_2_1 = str (mpl .__version__ ) <= LooseVersion ('1.2.1' )
447449 self .ts = tm .makeTimeSeries ()
448450 self .ts .name = 'ts'
449451
@@ -818,12 +820,13 @@ def test_hist_kwargs(self):
818820 self ._check_text_labels (ax .yaxis .get_label (), 'Degree' )
819821 tm .close ()
820822
821- ax = self .ts .plot (kind = 'hist' , orientation = 'horizontal' )
822- self ._check_text_labels (ax .xaxis .get_label (), 'Degree' )
823- tm .close ()
823+ if self .mpl_ge_1_3_1 :
824+ ax = self .ts .plot (kind = 'hist' , orientation = 'horizontal' )
825+ self ._check_text_labels (ax .xaxis .get_label (), 'Degree' )
826+ tm .close ()
824827
825- ax = self .ts .plot (kind = 'hist' , align = 'left' , stacked = True )
826- tm .close ()
828+ ax = self .ts .plot (kind = 'hist' , align = 'left' , stacked = True )
829+ tm .close ()
827830
828831 @slow
829832 def test_hist_kde_color (self ):
@@ -961,9 +964,6 @@ def setUp(self):
961964 import matplotlib as mpl
962965 mpl .rcdefaults ()
963966
964- self .mpl_le_1_2_1 = str (mpl .__version__ ) <= LooseVersion ('1.2.1' )
965- self .mpl_ge_1_3_1 = str (mpl .__version__ ) >= LooseVersion ('1.3.1' )
966-
967967 self .tdf = tm .makeTimeDataFrame ()
968968 self .hexbin_df = DataFrame ({"A" : np .random .uniform (size = 20 ),
969969 "B" : np .random .uniform (size = 20 ),
@@ -2141,31 +2141,33 @@ def test_hist_df_coord(self):
21412141 self ._check_box_coord (axes [2 ].patches , expected_y = np .array ([0 , 0 , 0 , 0 , 0 ]),
21422142 expected_h = np .array ([6 , 7 , 8 , 9 , 10 ]))
21432143
2144- # horizontal
2145- ax = df .plot (kind = 'hist' , bins = 5 , orientation = 'horizontal' )
2146- self ._check_box_coord (ax .patches [:5 ], expected_x = np .array ([0 , 0 , 0 , 0 , 0 ]),
2147- expected_w = np .array ([10 , 9 , 8 , 7 , 6 ]))
2148- self ._check_box_coord (ax .patches [5 :10 ], expected_x = np .array ([0 , 0 , 0 , 0 , 0 ]),
2149- expected_w = np .array ([8 , 8 , 8 , 8 , 8 ]))
2150- self ._check_box_coord (ax .patches [10 :], expected_x = np .array ([0 , 0 , 0 , 0 , 0 ]),
2151- expected_w = np .array ([6 , 7 , 8 , 9 , 10 ]))
2152-
2153- ax = df .plot (kind = 'hist' , bins = 5 , stacked = True , orientation = 'horizontal' )
2154- self ._check_box_coord (ax .patches [:5 ], expected_x = np .array ([0 , 0 , 0 , 0 , 0 ]),
2155- expected_w = np .array ([10 , 9 , 8 , 7 , 6 ]))
2156- self ._check_box_coord (ax .patches [5 :10 ], expected_x = np .array ([10 , 9 , 8 , 7 , 6 ]),
2157- expected_w = np .array ([8 , 8 , 8 , 8 , 8 ]))
2158- self ._check_box_coord (ax .patches [10 :], expected_x = np .array ([18 , 17 , 16 , 15 , 14 ]),
2159- expected_w = np .array ([6 , 7 , 8 , 9 , 10 ]))
2160-
2161- axes = df .plot (kind = 'hist' , bins = 5 , stacked = True ,
2162- subplots = True , orientation = 'horizontal' )
2163- self ._check_box_coord (axes [0 ].patches , expected_x = np .array ([0 , 0 , 0 , 0 , 0 ]),
2164- expected_w = np .array ([10 , 9 , 8 , 7 , 6 ]))
2165- self ._check_box_coord (axes [1 ].patches , expected_x = np .array ([0 , 0 , 0 , 0 , 0 ]),
2166- expected_w = np .array ([8 , 8 , 8 , 8 , 8 ]))
2167- self ._check_box_coord (axes [2 ].patches , expected_x = np .array ([0 , 0 , 0 , 0 , 0 ]),
2168- expected_w = np .array ([6 , 7 , 8 , 9 , 10 ]))
2144+ if self .mpl_ge_1_3_1 :
2145+
2146+ # horizontal
2147+ ax = df .plot (kind = 'hist' , bins = 5 , orientation = 'horizontal' )
2148+ self ._check_box_coord (ax .patches [:5 ], expected_x = np .array ([0 , 0 , 0 , 0 , 0 ]),
2149+ expected_w = np .array ([10 , 9 , 8 , 7 , 6 ]))
2150+ self ._check_box_coord (ax .patches [5 :10 ], expected_x = np .array ([0 , 0 , 0 , 0 , 0 ]),
2151+ expected_w = np .array ([8 , 8 , 8 , 8 , 8 ]))
2152+ self ._check_box_coord (ax .patches [10 :], expected_x = np .array ([0 , 0 , 0 , 0 , 0 ]),
2153+ expected_w = np .array ([6 , 7 , 8 , 9 , 10 ]))
2154+
2155+ ax = df .plot (kind = 'hist' , bins = 5 , stacked = True , orientation = 'horizontal' )
2156+ self ._check_box_coord (ax .patches [:5 ], expected_x = np .array ([0 , 0 , 0 , 0 , 0 ]),
2157+ expected_w = np .array ([10 , 9 , 8 , 7 , 6 ]))
2158+ self ._check_box_coord (ax .patches [5 :10 ], expected_x = np .array ([10 , 9 , 8 , 7 , 6 ]),
2159+ expected_w = np .array ([8 , 8 , 8 , 8 , 8 ]))
2160+ self ._check_box_coord (ax .patches [10 :], expected_x = np .array ([18 , 17 , 16 , 15 , 14 ]),
2161+ expected_w = np .array ([6 , 7 , 8 , 9 , 10 ]))
2162+
2163+ axes = df .plot (kind = 'hist' , bins = 5 , stacked = True ,
2164+ subplots = True , orientation = 'horizontal' )
2165+ self ._check_box_coord (axes [0 ].patches , expected_x = np .array ([0 , 0 , 0 , 0 , 0 ]),
2166+ expected_w = np .array ([10 , 9 , 8 , 7 , 6 ]))
2167+ self ._check_box_coord (axes [1 ].patches , expected_x = np .array ([0 , 0 , 0 , 0 , 0 ]),
2168+ expected_w = np .array ([8 , 8 , 8 , 8 , 8 ]))
2169+ self ._check_box_coord (axes [2 ].patches , expected_x = np .array ([0 , 0 , 0 , 0 , 0 ]),
2170+ expected_w = np .array ([6 , 7 , 8 , 9 , 10 ]))
21692171
21702172 @slow
21712173 def test_hist_df_legacy (self ):
0 commit comments