@@ -3282,39 +3282,33 @@ def errorbar(self, x, y, yerr=None, xerr=None,
3282
3282
if not np .iterable (yerr ):
3283
3283
yerr = [yerr ] * len (y )
3284
3284
3285
- plot_line = (fmt .lower () != 'none' )
3286
3285
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 )
3287
3300
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 )
3290
3304
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
+
3305
3307
if 'color' not in base_style :
3306
3308
base_style ['color' ] = 'C0'
3307
3309
if ecolor is None :
3308
3310
ecolor = base_style ['color' ]
3309
3311
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
-
3318
3312
# Make the style dict for the line collections (the bars), ejecting any
3319
3313
# marker information from format string.
3320
3314
eb_lines_style = dict (base_style )
@@ -3359,11 +3353,6 @@ def errorbar(self, x, y, yerr=None, xerr=None,
3359
3353
eb_cap_style [key ] = kwargs [key ]
3360
3354
eb_cap_style ['color' ] = ecolor
3361
3355
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
-
3367
3356
barcols = []
3368
3357
caplines = []
3369
3358
0 commit comments