Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a3b33fe

Browse files
committed
FIX: allow singleton labels in hist
1 parent a2d2b80 commit a3b33fe

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6756,9 +6756,11 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
67566756

67576757
if label is None:
67586758
labels = [None]
6759-
elif isinstance(label, str):
6760-
labels = [label]
67616759
else:
6760+
if isinstance(label, str):
6761+
label = [label]
6762+
elif not np.iterable(label):
6763+
label = [label]
67626764
labels = [str(lab) for lab in label]
67636765

67646766
for patch, lbl in itertools.zip_longest(patches, labels):

0 commit comments

Comments
 (0)