@@ -7166,33 +7166,21 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
71667166 # cast each element to str, but keep a single str as it.
71677167 labels = [] if label is None else np .atleast_1d (np .asarray (label , str ))
71687168
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 )))
71867173
71877174 for patch , lbl in itertools .zip_longest (patches , labels ):
71887175 if patch :
71897176 p = patch [0 ]
7190- if 'hatch' in kwargs :
7191- kwargs ['hatch' ] = next (hatches )
71927177 if 'edgecolor' in kwargs :
71937178 kwargs ['edgecolor' ] = next (edgecolors )
7194- if 'linewidth' in kwargs :
7195- kwargs ['linewidth' ] = next (linewidths )
7179+ kwargs .update ({
7180+ 'hatch' : next (hatches ),
7181+ 'linewidth' : next (linewidths ),
7182+ 'linestyle' : next (linestyles ),
7183+ })
71967184 p ._internal_update (kwargs )
71977185 if lbl is not None :
71987186 p .set_label (lbl )
0 commit comments