@@ -219,14 +219,14 @@ class _process_plot_var_args:
219219
220220 an arbitrary number of *x*, *y*, *fmt* are allowed
221221 """
222- def __init__ ( self , axes , command = 'plot' ):
223- self . axes = axes
222+
223+ def __init__ ( self , command = 'plot' ):
224224 self .command = command
225225 self .set_prop_cycle (None )
226226
227227 def __getstate__ (self ):
228228 # note: it is not possible to pickle a generator (and thus a cycler).
229- return {'axes' : self . axes , ' command' : self .command }
229+ return {'command' : self .command }
230230
231231 def __setstate__ (self , state ):
232232 self .__dict__ = state .copy ()
@@ -238,8 +238,8 @@ def set_prop_cycle(self, cycler):
238238 self .prop_cycler = itertools .cycle (cycler )
239239 self ._prop_keys = cycler .keys # This should make a copy
240240
241- def __call__ (self , * args , data = None , ** kwargs ):
242- self . axes ._process_unit_info (kwargs = kwargs )
241+ def __call__ (self , axes , * args , data = None , ** kwargs ):
242+ axes ._process_unit_info (kwargs = kwargs )
243243
244244 for pos_only in "xy" :
245245 if pos_only in kwargs :
@@ -309,7 +309,7 @@ def __call__(self, *args, data=None, **kwargs):
309309 this += args [0 ],
310310 args = args [1 :]
311311 yield from self ._plot_args (
312- this , kwargs , ambiguous_fmt_datakey = ambiguous_fmt_datakey )
312+ axes , this , kwargs , ambiguous_fmt_datakey = ambiguous_fmt_datakey )
313313
314314 def get_next_color (self ):
315315 """Return the next color in the cycle."""
@@ -344,17 +344,17 @@ def _setdefaults(self, defaults, kw):
344344 if kw .get (k , None ) is None :
345345 kw [k ] = defaults [k ]
346346
347- def _makeline (self , x , y , kw , kwargs ):
347+ def _makeline (self , axes , x , y , kw , kwargs ):
348348 kw = {** kw , ** kwargs } # Don't modify the original kw.
349349 default_dict = self ._getdefaults (set (), kw )
350350 self ._setdefaults (default_dict , kw )
351351 seg = mlines .Line2D (x , y , ** kw )
352352 return seg , kw
353353
354- def _makefill (self , x , y , kw , kwargs ):
354+ def _makefill (self , axes , x , y , kw , kwargs ):
355355 # Polygon doesn't directly support unitized inputs.
356- x = self . axes .convert_xunits (x )
357- y = self . axes .convert_yunits (y )
356+ x = axes .convert_xunits (x )
357+ y = axes .convert_yunits (y )
358358
359359 kw = kw .copy () # Don't modify the original kw.
360360 kwargs = kwargs .copy ()
@@ -403,7 +403,7 @@ def _makefill(self, x, y, kw, kwargs):
403403 seg .set (** kwargs )
404404 return seg , kwargs
405405
406- def _plot_args (self , tup , kwargs , * ,
406+ def _plot_args (self , axes , tup , kwargs , * ,
407407 return_kwargs = False , ambiguous_fmt_datakey = False ):
408408 """
409409 Process the arguments of ``plot([x], y, [fmt], **kwargs)`` calls.
@@ -495,10 +495,10 @@ def _plot_args(self, tup, kwargs, *,
495495 else :
496496 x , y = index_of (xy [- 1 ])
497497
498- if self . axes .xaxis is not None :
499- self . axes .xaxis .update_units (x )
500- if self . axes .yaxis is not None :
501- self . axes .yaxis .update_units (y )
498+ if axes .xaxis is not None :
499+ axes .xaxis .update_units (x )
500+ if axes .yaxis is not None :
501+ axes .yaxis .update_units (y )
502502
503503 if x .shape [0 ] != y .shape [0 ]:
504504 raise ValueError (f"x and y must have same first dimension, but "
@@ -534,7 +534,7 @@ def _plot_args(self, tup, kwargs, *,
534534 else :
535535 labels = [label ] * n_datasets
536536
537- result = (make_artist (x [:, j % ncx ], y [:, j % ncy ], kw ,
537+ result = (make_artist (axes , x [:, j % ncx ], y [:, j % ncy ], kw ,
538538 {** kwargs , 'label' : label })
539539 for j , label in enumerate (labels ))
540540
@@ -1292,8 +1292,8 @@ def __clear(self):
12921292 self ._tight = None
12931293 self ._use_sticky_edges = True
12941294
1295- self ._get_lines = _process_plot_var_args (self )
1296- self ._get_patches_for_fill = _process_plot_var_args (self , 'fill' )
1295+ self ._get_lines = _process_plot_var_args ()
1296+ self ._get_patches_for_fill = _process_plot_var_args ('fill' )
12971297
12981298 self ._gridOn = mpl .rcParams ['axes.grid' ]
12991299 old_children , self ._children = self ._children , []
0 commit comments