@@ -847,7 +847,7 @@ def test_area_lim(self):
847
847
@pytest .mark .slow
848
848
def test_bar_colors (self ):
849
849
import matplotlib .pyplot as plt
850
- default_colors = [ v [ 'color' ] for v in plt .rcParams [ 'axes.prop_cycle' ]]
850
+ default_colors = self . _unpack_cycler ( plt .rcParams )
851
851
852
852
df = DataFrame (randn (5 , 5 ))
853
853
ax = df .plot .bar ()
@@ -1218,8 +1218,7 @@ def test_scatter_colors(self):
1218
1218
with pytest .raises (TypeError ):
1219
1219
df .plot .scatter (x = 'a' , y = 'b' , c = 'c' , color = 'green' )
1220
1220
1221
- default_colors = [v ['color' ]
1222
- for v in self .plt .rcParams ['axes.prop_cycle' ]]
1221
+ default_colors = self ._unpack_cycler (self .plt .rcParams )
1223
1222
1224
1223
ax = df .plot .scatter (x = 'a' , y = 'b' , c = 'c' )
1225
1224
tm .assert_numpy_array_equal (
@@ -1883,8 +1882,7 @@ def test_dont_modify_colors(self):
1883
1882
def test_line_colors_and_styles_subplots (self ):
1884
1883
# GH 9894
1885
1884
from matplotlib import cm
1886
- default_colors = [v ['color' ]
1887
- for v in self .plt .rcParams ['axes.prop_cycle' ]]
1885
+ default_colors = self ._unpack_cycler (self .plt .rcParams )
1888
1886
1889
1887
df = DataFrame (randn (5 , 5 ))
1890
1888
@@ -2004,8 +2002,7 @@ def test_area_colors(self):
2004
2002
2005
2003
@pytest .mark .slow
2006
2004
def test_hist_colors (self ):
2007
- default_colors = [v ['color' ]
2008
- for v in self .plt .rcParams ['axes.prop_cycle' ]]
2005
+ default_colors = self ._unpack_cycler (self .plt .rcParams )
2009
2006
2010
2007
df = DataFrame (randn (5 , 5 ))
2011
2008
ax = df .plot .hist ()
@@ -2066,8 +2063,7 @@ def test_kde_colors_and_styles_subplots(self):
2066
2063
_skip_if_no_scipy_gaussian_kde ()
2067
2064
2068
2065
from matplotlib import cm
2069
- default_colors = [v ['color' ]
2070
- for v in self .plt .rcParams ['axes.prop_cycle' ]]
2066
+ default_colors = self ._unpack_cycler (self .plt .rcParams )
2071
2067
2072
2068
df = DataFrame (randn (5 , 5 ))
2073
2069
@@ -2138,8 +2134,7 @@ def _check_colors(bp, box_c, whiskers_c, medians_c, caps_c='k',
2138
2134
self ._check_colors (bp ['caps' ],
2139
2135
linecolors = [caps_c ] * len (bp ['caps' ]))
2140
2136
2141
- default_colors = [v ['color' ]
2142
- for v in self .plt .rcParams ['axes.prop_cycle' ]]
2137
+ default_colors = self ._unpack_cycler (self .plt .rcParams )
2143
2138
2144
2139
df = DataFrame (randn (5 , 5 ))
2145
2140
bp = df .plot .box (return_type = 'dict' )
@@ -2195,7 +2190,7 @@ def test_default_color_cycle(self):
2195
2190
df = DataFrame (randn (5 , 3 ))
2196
2191
ax = df .plot ()
2197
2192
2198
- expected = [ v [ 'color' ] for v in plt .rcParams [ 'axes.prop_cycle' ]] [:3 ]
2193
+ expected = self . _unpack_cycler ( plt .rcParams ) [:3 ]
2199
2194
self ._check_colors (ax .get_lines (), linecolors = expected )
2200
2195
2201
2196
def test_unordered_ts (self ):
0 commit comments