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

Skip to content

Commit defa63c

Browse files
committed
Return used kwargs from _process_plot_var_args._plot_args.
1 parent 0543e9d commit defa63c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def _makeline(self, x, y, kw, kwargs):
310310
default_dict = self._getdefaults(set(), kw)
311311
self._setdefaults(default_dict, kw)
312312
seg = mlines.Line2D(x, y, **kw)
313-
return seg
313+
return seg, kw
314314

315315
def _makefill(self, x, y, kw, kwargs):
316316
# Polygon doesn't directly support unitized inputs.
@@ -362,9 +362,9 @@ def _makefill(self, x, y, kw, kwargs):
362362
fill=kwargs.get('fill', True),
363363
closed=kw['closed'])
364364
seg.set(**kwargs)
365-
return seg
365+
return seg, kwargs
366366

367-
def _plot_args(self, tup, kwargs):
367+
def _plot_args(self, tup, kwargs, return_kwargs=False):
368368
if len(tup) > 1 and isinstance(tup[-1], str):
369369
linestyle, marker, color = _process_plot_format(tup[-1])
370370
tup = tup[:-1]
@@ -415,8 +415,12 @@ def _plot_args(self, tup, kwargs):
415415
ncx, ncy = x.shape[1], y.shape[1]
416416
if ncx > 1 and ncy > 1 and ncx != ncy:
417417
raise ValueError(f"x has {ncx} columns but y has {ncy} columns")
418-
return [func(x[:, j % ncx], y[:, j % ncy], kw, kwargs)
419-
for j in range(max(ncx, ncy))]
418+
result = (func(x[:, j % ncx], y[:, j % ncy], kw, kwargs)
419+
for j in range(max(ncx, ncy)))
420+
if return_kwargs:
421+
return list(result)
422+
else:
423+
return [l[0] for l in result]
420424

421425

422426
@cbook._define_aliases({"facecolor": ["fc"]})

0 commit comments

Comments
 (0)