@@ -33,7 +33,7 @@ def _skip_if_mpl_14_or_dev_boxplot():
33
33
# Boxplot failures on 1.4 and 1.4.1
34
34
# Don't need try / except since that's done at class level
35
35
import matplotlib
36
- if matplotlib .__version__ in ('1.4.0' , '1.5.x ' ):
36
+ if matplotlib .__version__ >= LooseVersion ('1.4' ):
37
37
raise nose .SkipTest ("Matplotlib Regression in 1.4 and current dev." )
38
38
39
39
@@ -72,6 +72,11 @@ def setUp(self):
72
72
'weight' : random .normal (161 , 32 , size = n ),
73
73
'category' : random .randint (4 , size = n )})
74
74
75
+ if mpl .__version__ >= LooseVersion ('1.4' ):
76
+ self .bp_n_objects = 7
77
+ else :
78
+ self .bp_n_objects = 8
79
+
75
80
def tearDown (self ):
76
81
tm .close ()
77
82
@@ -1799,23 +1804,26 @@ def test_bar_log_subplots(self):
1799
1804
1800
1805
@slow
1801
1806
def test_boxplot (self ):
1802
- _skip_if_mpl_14_or_dev_boxplot ()
1803
1807
df = self .hist_df
1804
1808
series = df ['height' ]
1805
1809
numeric_cols = df ._get_numeric_data ().columns
1806
1810
labels = [com .pprint_thing (c ) for c in numeric_cols ]
1807
1811
1808
1812
ax = _check_plot_works (df .plot , kind = 'box' )
1809
1813
self ._check_text_labels (ax .get_xticklabels (), labels )
1810
- assert_array_equal (ax .xaxis .get_ticklocs (), np .arange (1 , len (numeric_cols ) + 1 ))
1811
- self .assertEqual (len (ax .lines ), 8 * len (numeric_cols ))
1814
+ assert_array_equal (ax .xaxis .get_ticklocs (),
1815
+ np .arange (1 , len (numeric_cols ) + 1 ))
1816
+ self .assertEqual (len (ax .lines ),
1817
+ self .bp_n_objects * len (numeric_cols ))
1812
1818
1813
- axes = _check_plot_works (df .plot , kind = 'box' , subplots = True , logy = True )
1819
+ with tm .assert_produces_warning (UserWarning ):
1820
+ axes = _check_plot_works (df .plot , kind = 'box' ,
1821
+ subplots = True , logy = True )
1814
1822
self ._check_axes_shape (axes , axes_num = 3 , layout = (1 , 3 ))
1815
1823
self ._check_ax_scales (axes , yaxis = 'log' )
1816
1824
for ax , label in zip (axes , labels ):
1817
1825
self ._check_text_labels (ax .get_xticklabels (), [label ])
1818
- self .assertEqual (len (ax .lines ), 8 )
1826
+ self .assertEqual (len (ax .lines ), self . bp_n_objects )
1819
1827
1820
1828
axes = series .plot (kind = 'box' , rot = 40 )
1821
1829
self ._check_ticks_props (axes , xrot = 40 , yrot = 0 )
@@ -1829,35 +1837,33 @@ def test_boxplot(self):
1829
1837
labels = [com .pprint_thing (c ) for c in numeric_cols ]
1830
1838
self ._check_text_labels (ax .get_xticklabels (), labels )
1831
1839
assert_array_equal (ax .xaxis .get_ticklocs (), positions )
1832
- self .assertEqual (len (ax .lines ), 8 * len (numeric_cols ))
1840
+ self .assertEqual (len (ax .lines ), self . bp_n_objects * len (numeric_cols ))
1833
1841
1834
1842
@slow
1835
1843
def test_boxplot_vertical (self ):
1836
- _skip_if_mpl_14_or_dev_boxplot ()
1837
1844
df = self .hist_df
1838
- series = df ['height' ]
1839
1845
numeric_cols = df ._get_numeric_data ().columns
1840
1846
labels = [com .pprint_thing (c ) for c in numeric_cols ]
1841
1847
1842
1848
# if horizontal, yticklabels are rotated
1843
1849
ax = df .plot (kind = 'box' , rot = 50 , fontsize = 8 , vert = False )
1844
1850
self ._check_ticks_props (ax , xrot = 0 , yrot = 50 , ylabelsize = 8 )
1845
1851
self ._check_text_labels (ax .get_yticklabels (), labels )
1846
- self .assertEqual (len (ax .lines ), 8 * len (numeric_cols ))
1852
+ self .assertEqual (len (ax .lines ), self . bp_n_objects * len (numeric_cols ))
1847
1853
1848
1854
axes = _check_plot_works (df .plot , kind = 'box' , subplots = True ,
1849
1855
vert = False , logx = True )
1850
1856
self ._check_axes_shape (axes , axes_num = 3 , layout = (1 , 3 ))
1851
1857
self ._check_ax_scales (axes , xaxis = 'log' )
1852
1858
for ax , label in zip (axes , labels ):
1853
1859
self ._check_text_labels (ax .get_yticklabels (), [label ])
1854
- self .assertEqual (len (ax .lines ), 8 )
1860
+ self .assertEqual (len (ax .lines ), self . bp_n_objects )
1855
1861
1856
1862
positions = np .array ([3 , 2 , 8 ])
1857
1863
ax = df .plot (kind = 'box' , positions = positions , vert = False )
1858
1864
self ._check_text_labels (ax .get_yticklabels (), labels )
1859
1865
assert_array_equal (ax .yaxis .get_ticklocs (), positions )
1860
- self .assertEqual (len (ax .lines ), 8 * len (numeric_cols ))
1866
+ self .assertEqual (len (ax .lines ), self . bp_n_objects * len (numeric_cols ))
1861
1867
1862
1868
@slow
1863
1869
def test_boxplot_return_type (self ):
0 commit comments