@@ -223,26 +223,21 @@ class _process_plot_var_args:
223223 def __init__ (self , axes , command = 'plot' ):
224224 self .axes = axes
225225 self .command = command
226- self .set_prop_cycle ()
226+ self .set_prop_cycle (None )
227227
228228 def __getstate__ (self ):
229229 # note: it is not possible to pickle a generator (and thus a cycler).
230230 return {'axes' : self .axes , 'command' : self .command }
231231
232232 def __setstate__ (self , state ):
233233 self .__dict__ = state .copy ()
234- self .set_prop_cycle ()
234+ self .set_prop_cycle (None )
235235
236- def set_prop_cycle (self , * args , ** kwargs ):
237- # Can't do `args == (None,)` as that crashes cycler.
238- if not (args or kwargs ) or (len (args ) == 1 and args [0 ] is None ):
239- prop_cycler = mpl .rcParams ['axes.prop_cycle' ]
240- else :
241- prop_cycler = cycler (* args , ** kwargs )
242-
243- self .prop_cycler = itertools .cycle (prop_cycler )
244- # This should make a copy
245- self ._prop_keys = prop_cycler .keys
236+ def set_prop_cycle (self , cycler ):
237+ if cycler is None :
238+ cycler = mpl .rcParams ['axes.prop_cycle' ]
239+ self .prop_cycler = itertools .cycle (cycler )
240+ self ._prop_keys = cycler .keys # This should make a copy
246241
247242 def __call__ (self , * args , data = None , ** kwargs ):
248243 self .axes ._process_unit_info (kwargs = kwargs )
0 commit comments