@@ -7166,33 +7166,16 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
7166
7166
# cast each element to str, but keep a single str as it.
7167
7167
labels = [] if label is None else np .atleast_1d (np .asarray (label , str ))
7168
7168
7169
- if 'hatch' in kwargs :
7170
- if not isinstance (kwargs ['hatch' ], str ):
7171
- hatches = itertools .cycle (kwargs ['hatch' ])
7172
- else :
7173
- hatches = itertools .cycle ([kwargs ['hatch' ]])
7174
-
7175
- if 'edgecolor' in kwargs :
7176
- if not isinstance (kwargs ['edgecolor' ], str ):
7177
- edgecolors = itertools .cycle (kwargs ['edgecolor' ])
7178
- else :
7179
- edgecolors = itertools .cycle ([kwargs ['edgecolor' ]])
7180
-
7181
- if 'linewidth' in kwargs :
7182
- if isinstance (kwargs ['linewidth' ], list or tuple ):
7183
- linewidths = itertools .cycle (kwargs ['linewidth' ])
7184
- else :
7185
- linewidths = itertools .cycle ([kwargs ['linewidth' ]])
7169
+ hatches = itertools .cycle (np .atleast_1d (kwargs .get ('hatch' , None )))
7170
+ edgecolors = itertools .cycle (np .atleast_1d (kwargs .get ('edgecolor' , None )))
7171
+ linewidths = itertools .cycle (np .atleast_1d (kwargs .get ('linewidth' , None )))
7172
+ linestyles = itertools .cycle (np .atleast_1d (kwargs .get ('linestyle' , None )))
7186
7173
7187
7174
for patch , lbl in itertools .zip_longest (patches , labels ):
7188
7175
if patch :
7189
7176
p = patch [0 ]
7190
- if 'hatch' in kwargs :
7191
- kwargs ['hatch' ] = next (hatches )
7192
- if 'edgecolor' in kwargs :
7193
- kwargs ['edgecolor' ] = next (edgecolors )
7194
- if 'linewidth' in kwargs :
7195
- kwargs ['linewidth' ] = next (linewidths )
7177
+ kwargs = {'edgecolor' : next (edgecolors ), 'linewidth' : next (linewidths ),
7178
+ 'hatch' : next (hatches ), 'linestyle' : next (linestyles )}
7196
7179
p ._internal_update (kwargs )
7197
7180
if lbl is not None :
7198
7181
p .set_label (lbl )
0 commit comments