Skip to content

Commit 0349e7d

Browse files
committed
Made None patch condition explicit
1 parent 6029e32 commit 0349e7d

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7226,21 +7226,22 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
72267226
linestyles = itertools.cycle(np.atleast_1d(kwargs.get('linestyle', None)))
72277227

72287228
for patch, lbl in itertools.zip_longest(patches, labels):
7229-
if patch:
7230-
p = patch[0]
7231-
kwargs.update({
7232-
'hatch': next(hatches),
7233-
'linewidth': next(linewidths),
7234-
'linestyle': next(linestyles),
7235-
'edgecolor': next(edgecolors),
7236-
'facecolor': next(facecolors),
7237-
})
7229+
if not patch:
7230+
continue
7231+
p = patch[0]
7232+
kwargs.update({
7233+
'hatch': next(hatches),
7234+
'linewidth': next(linewidths),
7235+
'linestyle': next(linestyles),
7236+
'edgecolor': next(edgecolors),
7237+
'facecolor': next(facecolors),
7238+
})
7239+
p._internal_update(kwargs)
7240+
if lbl is not None:
7241+
p.set_label(lbl)
7242+
for p in patch[1:]:
72387243
p._internal_update(kwargs)
7239-
if lbl is not None:
7240-
p.set_label(lbl)
7241-
for p in patch[1:]:
7242-
p._internal_update(kwargs)
7243-
p.set_label('_nolegend_')
7244+
p.set_label('_nolegend_')
72447245

72457246
if nx == 1:
72467247
return tops[0], bins, patches[0]

0 commit comments

Comments
 (0)