@@ -7211,33 +7211,21 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
7211
7211
# cast each element to str, but keep a single str as it.
7212
7212
labels = [] if label is None else np .atleast_1d (np .asarray (label , str ))
7213
7213
7214
- if 'hatch' in kwargs :
7215
- if not isinstance (kwargs ['hatch' ], str ):
7216
- hatches = itertools .cycle (kwargs ['hatch' ])
7217
- else :
7218
- hatches = itertools .cycle ([kwargs ['hatch' ]])
7219
-
7220
- if 'edgecolor' in kwargs :
7221
- if not isinstance (kwargs ['edgecolor' ], str ):
7222
- edgecolors = itertools .cycle (kwargs ['edgecolor' ])
7223
- else :
7224
- edgecolors = itertools .cycle ([kwargs ['edgecolor' ]])
7225
-
7226
- if 'linewidth' in kwargs :
7227
- if isinstance (kwargs ['linewidth' ], list or tuple ):
7228
- linewidths = itertools .cycle (kwargs ['linewidth' ])
7229
- else :
7230
- linewidths = itertools .cycle ([kwargs ['linewidth' ]])
7214
+ hatches = itertools .cycle (np .atleast_1d (kwargs .get ('hatch' , None )))
7215
+ edgecolors = itertools .cycle (np .atleast_1d (kwargs .get ('edgecolor' , None )))
7216
+ linewidths = itertools .cycle (np .atleast_1d (kwargs .get ('linewidth' , None )))
7217
+ linestyles = itertools .cycle (np .atleast_1d (kwargs .get ('linestyle' , None )))
7231
7218
7232
7219
for patch , lbl in itertools .zip_longest (patches , labels ):
7233
7220
if patch :
7234
7221
p = patch [0 ]
7235
- if 'hatch' in kwargs :
7236
- kwargs ['hatch' ] = next (hatches )
7237
7222
if 'edgecolor' in kwargs :
7238
7223
kwargs ['edgecolor' ] = next (edgecolors )
7239
- if 'linewidth' in kwargs :
7240
- kwargs ['linewidth' ] = next (linewidths )
7224
+ kwargs .update ({
7225
+ 'hatch' : next (hatches ),
7226
+ 'linewidth' : next (linewidths ),
7227
+ 'linestyle' : next (linestyles ),
7228
+ })
7241
7229
p ._internal_update (kwargs )
7242
7230
if lbl is not None :
7243
7231
p .set_label (lbl )
0 commit comments