@@ -77,6 +77,9 @@ def setUp(self):
77
77
else :
78
78
self .bp_n_objects = 8
79
79
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
+
80
83
def tearDown (self ):
81
84
tm .close ()
82
85
@@ -443,7 +446,6 @@ def setUp(self):
443
446
import matplotlib as mpl
444
447
mpl .rcdefaults ()
445
448
446
- self .mpl_le_1_2_1 = str (mpl .__version__ ) <= LooseVersion ('1.2.1' )
447
449
self .ts = tm .makeTimeSeries ()
448
450
self .ts .name = 'ts'
449
451
@@ -818,12 +820,13 @@ def test_hist_kwargs(self):
818
820
self ._check_text_labels (ax .yaxis .get_label (), 'Degree' )
819
821
tm .close ()
820
822
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 ()
824
827
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 ()
827
830
828
831
@slow
829
832
def test_hist_kde_color (self ):
@@ -961,9 +964,6 @@ def setUp(self):
961
964
import matplotlib as mpl
962
965
mpl .rcdefaults ()
963
966
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
-
967
967
self .tdf = tm .makeTimeDataFrame ()
968
968
self .hexbin_df = DataFrame ({"A" : np .random .uniform (size = 20 ),
969
969
"B" : np .random .uniform (size = 20 ),
@@ -2141,31 +2141,33 @@ def test_hist_df_coord(self):
2141
2141
self ._check_box_coord (axes [2 ].patches , expected_y = np .array ([0 , 0 , 0 , 0 , 0 ]),
2142
2142
expected_h = np .array ([6 , 7 , 8 , 9 , 10 ]))
2143
2143
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 ]))
2169
2171
2170
2172
@slow
2171
2173
def test_hist_df_legacy (self ):
0 commit comments