@@ -219,14 +219,14 @@ class _process_plot_var_args:
219
219
220
220
an arbitrary number of *x*, *y*, *fmt* are allowed
221
221
"""
222
- def __init__ ( self , axes , command = 'plot' ):
223
- self . axes = axes
222
+
223
+ def __init__ ( self , command = 'plot' ):
224
224
self .command = command
225
225
self .set_prop_cycle (None )
226
226
227
227
def __getstate__ (self ):
228
228
# 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 }
230
230
231
231
def __setstate__ (self , state ):
232
232
self .__dict__ = state .copy ()
@@ -238,8 +238,8 @@ def set_prop_cycle(self, cycler):
238
238
self .prop_cycler = itertools .cycle (cycler )
239
239
self ._prop_keys = cycler .keys # This should make a copy
240
240
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 )
243
243
244
244
for pos_only in "xy" :
245
245
if pos_only in kwargs :
@@ -309,7 +309,7 @@ def __call__(self, *args, data=None, **kwargs):
309
309
this += args [0 ],
310
310
args = args [1 :]
311
311
yield from self .
67ED
_plot_args (
312
- this , kwargs , ambiguous_fmt_datakey = ambiguous_fmt_datakey )
312
+ axes , this , kwargs , ambiguous_fmt_datakey = ambiguous_fmt_datakey )
313
313
314
314
def get_next_color (self ):
315
315
"""Return the next color in the cycle."""
@@ -344,17 +344,17 @@ def _setdefaults(self, defaults, kw):
344
344
if kw .get (k , None ) is None :
345
345
kw [k ] = defaults [k ]
346
346
347
- def _makeline (self , x , y , kw , kwargs ):
347
+ def _makeline (self , axes , x , y , kw , kwargs ):
348
348
kw = {** kw , ** kwargs } # Don't modify the original kw.
349
349
default_dict = self ._getdefaults (set (), kw )
350
350
self ._setdefaults (default_dict , kw )
351
351
seg = mlines .Line2D (x , y , ** kw )
352
352
return seg , kw
353
353
354
- def _makefill (self , x , y , kw , kwargs ):
354
+ def _makefill (self , axes , x , y , kw , kwargs ):
355
355
# 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 )
358
358
359
359
kw = kw .copy () # Don't modify the original kw.
360
360
kwargs = kwargs .copy ()
@@ -403,7 +403,7 @@ def _makefill(self, x, y, kw, kwargs):
403
403
seg .set (** kwargs )
404
404
return seg , kwargs
405
405
406
- def _plot_args (self , tup , kwargs , * ,
406
+ def _plot_args (self , axes , tup , kwargs , * ,
407
407
return_kwargs = False , ambiguous_fmt_datakey = False ):
408
408
"""
409
409
Process the arguments of ``plot([x], y, [fmt], **kwargs)`` calls.
@@ -495,10 +495,10 @@ def _plot_args(self, tup, kwargs, *,
495
495
else :
496
496
x , y = index_of (xy [- 1 ])
497
497
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 )
502
502
503
503
if x .shape [0 ] != y .shape [0 ]:
504
504
raise ValueError (f"x and y must have same first dimension, but "
@@ -534,7 +534,7 @@ def _plot_args(self, tup, kwargs, *,
534
534
else :
535
535
labels = [label ] * n_datasets
536
536
537
- result = (make_artist (x [:, j % ncx ], y [:, j % ncy ], kw ,
537
+ result = (make_artist (axes , x [:, j % ncx ], y [:, j % ncy ], kw ,
538
538
{** kwargs , 'label' : label })
539
539
for j , label in enumerate (labels ))
540
540
@@ -1292,8 +1292,8 @@ def __clear(self):
1292
1292
self ._tight = None
1293
1293
self ._use_sticky_edges = True
1294
1294
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' )
1297
1297
1298
1298
self ._gridOn = mpl .rcParams ['axes.grid' ]
1299
1299
old_children , self ._children = self ._children , []
0 commit comments