Skip to content

Commit b99c8ac

Browse files
committed
Add multiple label support for Axes.plot()
1 parent 18a3bee commit b99c8ac

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,9 @@ def _plot_args(self, tup, kwargs, return_kwargs=False):
448448
if ncx > 1 and ncy > 1 and ncx != ncy:
449449
raise ValueError(f"x has {ncx} columns but y has {ncy} columns")
450450

451-
if ('label' in kwargs and isinstance(kwargs['label'], Iterable)
452-
and not isinstance(kwargs['label'], str)):
451+
if ('label' in kwargs and max(ncx, ncy) > 1
452+
and isinstance(kwargs['label'], Iterable)
453+
and not isinstance(kwargs['label'], str)):
453454
if len(kwargs['label']) != max(ncx, ncy):
454455
raise ValueError(f"if label is iterable label and input data"
455456
f" must have same length, but have lengths "

0 commit comments

Comments
 (0)