@@ -3282,39 +3282,33 @@ def errorbar(self, x, y, yerr=None, xerr=None,
32823282 if not np .iterable (yerr ):
32833283 yerr = [yerr ] * len (y )
32843284
3285- plot_line = (fmt .lower () != 'none' )
32863285 label = kwargs .pop ("label" , None )
3286+ kwargs ['label' ] = '_nolegend_'
3287+
3288+ # Create the main line and determine overall kwargs for child artists.
3289+ # We avoid calling self.plot() directly, or self._get_lines(), because
3290+ # that would call self._process_unit_info again, and do other indirect
3291+ # data processing.
3292+ (data_line , base_style ), = self ._get_lines ._plot_args (
3293+ (x , y ) if fmt == '' else (x , y , fmt ), kwargs , return_kwargs = True )
3294+
3295+ # Do this after creating `data_line` to avoid modifying `base_style`.
3296+ if barsabove :
3297+ data_line .set_zorder (kwargs ['zorder' ] - .1 )
3298+ else :
3299+ data_line .set_zorder (kwargs ['zorder' ] + .1 )
32873300
3288- if fmt == '' :
3289- fmt_style_kwargs = {}
3301+ # Add line to plot, or throw it away and use it to determine kwargs.
3302+ if fmt .lower () != 'none' :
3303+ self .add_line (data_line )
32903304 else :
3291- fmt_style_kwargs = {k : v for k , v in
3292- zip (('linestyle' , 'marker' , 'color' ),
3293- _process_plot_format (fmt ))
3294- if v is not None }
3295- if fmt == 'none' :
3296- # Remove alpha=0 color that _process_plot_format returns
3297- fmt_style_kwargs .pop ('color' )
3298-
3299- base_style = self ._get_lines ._getdefaults (
3300- set (), {** fmt_style_kwargs , ** kwargs })
3301- if 'color' in kwargs :
3302- base_style ['color' ] = kwargs .pop ('color' )
3303- base_style ['label' ] = '_nolegend_'
3304- base_style .update (fmt_style_kwargs )
3305+ data_line = None
3306+
33053307 if 'color' not in base_style :
33063308 base_style ['color' ] = 'C0'
33073309 if ecolor is None :
33083310 ecolor = base_style ['color' ]
33093311
3310- # make the style dict for the 'normal' plot line
3311- plot_line_style = {
3312- ** base_style ,
3313- ** kwargs ,
3314- 'zorder' : (kwargs ['zorder' ] - .1 if barsabove else
3315- kwargs ['zorder' ] + .1 ),
3316- }
3317-
33183312 # Make the style dict for the line collections (the bars), ejecting any
33193313 # marker information from format string.
33203314 eb_lines_style = dict (base_style )
@@ -3359,11 +3353,6 @@ def errorbar(self, x, y, yerr=None, xerr=None,
33593353 eb_cap_style [key ] = kwargs [key ]
33603354 eb_cap_style ['color' ] = ecolor
33613355
3362- data_line = None
3363- if plot_line :
3364- data_line = mlines .Line2D (x , y , ** plot_line_style )
3365- self .add_line (data_line )
3366-
33673356 barcols = []
33683357 caplines = []
33693358
0 commit comments