8000 Inline _grab_next_args. · matplotlib/matplotlib@b83f96c · GitHub
[go: up one dir, main page]

Skip to content

Commit b83f96c

Browse files
committed
Inline _grab_next_args.
1 parent 640ecd9 commit b83f96c

File tree

2 files changed

+12
-21
lines changed

2 files changed

+12
-21
lines changed

lib/matplotlib/axes/_axes.py

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

11091109
return colls
11101110

1111-
# ### Basic plotting
1111+
#### Basic plotting
1112+
11121113
# The label_naming happens in `matplotlib.axes._base._plot_args`
11131114
@_preprocess_data(replace_names=["x", "y"],
11141115
positional_parameter_names=_plot_args_replacer,
@@ -1343,13 +1344,11 @@ def plot(self, *args, **kwargs):
13431344
"""
13441345
scalex = kwargs.pop('scalex', True)
13451346
scaley = kwargs.pop('scaley', True)
1346-
lines = []
1347-
13481347
kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D._alias_map)
13491348

1350-
for line in self._get_lines(*args, **kwargs):
1349+
lines = [*self._get_lines(*args, **kwargs)]
1350+
for line in lines:
13511351
self.add_line(line)
1352-
lines.append(line)
13531352

13541353
self.autoscale_view(scalex=scalex, scaley=scaley)
13551354
return lines

lib/matplotlib/axes/_base.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -169,23 +169,23 @@ def set_prop_cycle(self, *args, **kwargs):
169169
def __call__(self, *args, **kwargs):
170170
if self.axes.xaxis is not None and self.axes.yaxis is not None:
171171
xunits = kwargs.pop('xunits', self.axes.xaxis.units)
172-
173172
if self.axes.name == 'polar':
174173
xunits = kwargs.pop('thetaunits', xunits)
174+
if xunits != self.axes.xaxis.units:
175+
self.axes.xaxis.set_units(xunits)
175176

176177
yunits = kwargs.pop('yunits', self.axes.yaxis.units)
177-
178178
if self.axes.name == 'polar':
179179
yunits = kwargs.pop('runits', yunits)
180-
181-
if xunits != self.axes.xaxis.units:
182-
self.axes.xaxis.set_units(xunits)
183-
184180
if yunits != self.axes.yaxis.units:
185181
self.axes.yaxis.set_units(yunits)
186182

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

190190
def get_next_color(self):
191191
"""Return the next color in the cycle."""
@@ -386,14 +386,6 @@ def _plot_args(self, tup, kwargs):
386386
ret.append(seg)
387387
return ret
388388

389-
def _grab_next_args(self, *args, **kwargs):
390-
while args:
391-
this, args = args[:2], args[2:]
392-
if args and isinstance(args[0], str):
393-
this += args[0],
394-
args = args[1:]
395-
yield from self._plot_args(this, kwargs)
396-
397389

398390
class _AxesBase(martist.Artist):
399391
"""

0 commit comments

Comments
 (0)
0