@@ -3334,39 +3334,39 @@ def errorbar(self, x, y, yerr=None, xerr=None,
33343334 if not np .iterable (yerr ):
33353335 yerr = [yerr ] * len (y )
33363336
3337- plot_line = (fmt .lower () != 'none' )
33383337 label = kwargs .pop ("label" , None )
3338+ kwargs ['label' ] = '_nolegend_'
3339+
3340+ # Create the main line and determine overall kwargs for child artists.
3341+ # We avoid calling self.plot() directly, or self._get_lines(), because
3342+ # that would call self._process_unit_info again, and do other indirect
3343+ # data processing.
3344+ (data_line , base_style ), = self ._get_lines ._plot_args (
3345+ (x , y ) if fmt == '' else (x , y , fmt ), kwargs , return_kwargs = True )
3346+
3347+ # Do this after creating `data_line` to avoid modifying `base_style`.
3348+ if barsabove :
3349+ data_line .set_zorder (kwargs ['zorder' ] - .1 )
3350+ else :
3351+ data_line .set_zorder (kwargs ['zorder' ] + .1 )
33393352
3340- if fmt == '' :
3341- fmt_style_kwargs = {}
3353+ # Add line to plot, or throw it away and use it to determine kwargs.
3354+ if fmt .lower () != 'none' :
3355+ self .add_line (data_line )
33423356 else :
3343- fmt_style_kwargs = {k : v for k , v in
3344- zip (('linestyle' , 'marker' , 'color' ),
3345- _process_plot_format (fmt ))
3346- if v is not None }
3347- if fmt == 'none' :
3348- # Remove alpha=0 color that _process_plot_format returns
3349- fmt_style_kwargs .pop ('color' )
3350-
3351- base_style = self ._get_lines ._getdefaults (
3352- set (), {** fmt_style_kwargs , ** kwargs })
3353- if 'color' in kwargs :
3354- base_style ['color' ] = kwargs .pop ('color' )
3355- base_style ['label' ] = '_nolegend_'
3356- base_style .update (fmt_style_kwargs )
3357+ data_line = None
3358+ # Remove alpha=0 color that _get_lines._plot_args returns for
3359+ # 'none' format, and replace it with user-specified color, if
3360+ # supplied.
3361+ base_style .pop ('color' )
3362+ if 'color' in kwargs :
3363+ base_style ['color' ] = kwargs .pop ('color' )
3364+
33573365 if 'color' not in base_style :
33583366 base_style ['color' ] = 'C0'
33593367 if ecolor is None :
33603368 ecolor = base_style ['color' ]
33613369
3362- # make the style dict for the 'normal' plot line
3363- plot_line_style = {
3364- ** base_style ,
3365- ** kwargs ,
3366- 'zorder' : (kwargs ['zorder' ] - .1 if barsabove else
3367- kwargs ['zorder' ] + .1 ),
3368- }
3369-
33703370 # Make the style dict for the line collections (the bars), ejecting any
33713371 # marker information from format string.
33723372 eb_lines_style = dict (base_style )
@@ -3411,11 +3411,6 @@ def errorbar(self, x, y, yerr=None, xerr=None,
34113411 eb_cap_style [key ] = kwargs [key ]
34123412 eb_cap_style ['color' ] = ecolor
34133413
3414- data_line = None
3415- if plot_line :
3416- data_line = mlines .Line2D (x , y , ** plot_line_style )
3417- self .add_line (data_line )
3418-
34193414 barcols = []
34203415 caplines = []
34213416
0 commit comments