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

Skip to content

Commit 7b69287

Browse files
committed
Inline _grab_next_args.
1 parent 166d638 commit 7b69287

2 files changed

Lines changed: 10 additions & 17 deletions

File tree

lib/matplotlib/axes/_axes.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,8 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
13681368

13691369
return colls
13701370

1371-
# ### Basic plotting
1371+
#### Basic plotting
1372+
13721373
# The label_naming happens in `matplotlib.axes._base._plot_args`
13731374
@_preprocess_data(replace_names=["x", "y"],
13741375
positional_parameter_names=_plot_args_replacer,
@@ -1601,14 +1602,10 @@ def plot(self, *args, scalex=True, scaley=True, **kwargs):
16011602
'k^:' # black triangle_up markers connected by a dotted line
16021603
16031604
"""
1604-
lines = []
1605-
16061605
kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D._alias_map)
1607-
1608-
for line in self._get_lines(*args, **kwargs):
1606+
lines = [*self._get_lines(*args, **kwargs)]
1607+
for line in lines:
16091608
self.add_line(line)
1610-
lines.append(line)
1611-
16121609
self.autoscale_view(scalex=scalex, scaley=scaley)
16131610
return lines
16141611

lib/matplotlib/axes/_base.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,12 @@ def __call__(self, *args, **kwargs):
178178
if yunits != self.axes.yaxis.units:
179179
self.axes.yaxis.set_units(yunits)
180180

181-
ret = self._grab_next_args(*args, **kwargs)
182-
return ret
181+
while args:
182+
this, args = args[:2], args[2:]
183+
if args and isinstance(args[0], str):
184+
this += args[0],
185+
args = args[1:]
186+
yield from self._plot_args(this, kwargs)
183187

184188
def get_next_color(self):
185189
"""Return the next color in the cycle."""
@@ -381,14 +385,6 @@ def _plot_args(self, tup, kwargs):
381385
ret.append(seg)
382386
return ret
383387

384-
def _grab_next_args(self, *args, **kwargs):
385-
while args:
386-
this, args = args[:2], args[2:]
387-
if args and isinstance(args[0], str):
388-
this += args[0],
389-
args = args[1:]
390-
yield from self._plot_args(this, kwargs)
391-
392388

393389
class _AxesBase(martist.Artist):
394390
"""

0 commit comments

Comments
 (0)