@@ -119,14 +119,10 @@ def test_bar_colors(self):
119
119
tm .close ()
120
120
121
121
custom_colors = "rgcby"
122
- ax = df .plot .bar (color = custom_colors )
123
- self ._check_colors (ax .patches [::5 ], facecolors = custom_colors )
124
- tm .close ()
125
-
126
- custom_colors = "rgcby"
127
- ax = df .plot .bar (c = custom_colors )
128
- self ._check_colors (ax .patches [::5 ], facecolors = custom_colors )
129
- tm .close ()
122
+ for kw in ["c" , "color" ]:
123
+ ax = df .plot .bar (** {kw : "rgcby" })
124
+ self ._check_colors (ax .patches [::5 ], facecolors = custom_colors )
125
+ tm .close ()
130
126
131
127
from matplotlib import cm
132
128
@@ -142,19 +138,17 @@ def test_bar_colors(self):
142
138
self ._check_colors (ax .patches [::5 ], facecolors = rgba_colors )
143
139
tm .close ()
144
140
145
- ax = df .loc [:, [0 ]].plot .bar (color = "DodgerBlue" )
146
- self ._check_colors ([ax .patches [0 ]], facecolors = ["DodgerBlue" ])
147
- tm .close ()
148
-
149
- ax = df .loc [:, [0 ]].plot .bar (c = "DodgerBlue" )
150
- self ._check_colors ([ax .patches [0 ]], facecolors = ["DodgerBlue" ])
151
- tm .close ()
141
+ for kw in ["c" , "color" ]:
142
+ ax = df .loc [:, [0 ]].plot .bar (** {kw : "DodgerBlue" })
143
+ self ._check_colors ([ax .patches [0 ]], facecolors = ["DodgerBlue" ])
144
+ tm .close ()
152
145
153
146
ax = df .plot (kind = "bar" , color = "green" )
154
147
self ._check_colors (ax .patches [::5 ], facecolors = ["green" ] * 5 )
155
148
tm .close ()
156
149
157
- def test_bar_user_colors (self ):
150
+ @pytest .mark .parametrize ("kw" , ["c" , "color" ])
151
+ def test_bar_user_colors (self , kw ):
158
152
df = DataFrame (
159
153
{"A" : range (4 ), "B" : range (1 , 5 ), "color" : ["red" , "blue" , "blue" , "red" ]}
160
154
)
0 commit comments