@@ -3334,39 +3334,39 @@ def errorbar(self, x, y, yerr=None, xerr=None,
3334
3334
if not np .iterable (yerr ):
3335
3335
yerr = [yerr ] * len (y )
3336
3336
3337
- plot_line = (fmt .lower () != 'none' )
3338
3337
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 )
3339
3352
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 )
3342
3356
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
+
3357
3365
if 'color' not in base_style :
3358
3366
base_style ['color' ] = 'C0'
3359
3367
if ecolor is None :
3360
3368
ecolor = base_style ['color' ]
3361
3369
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
-
3370
3370
# Make the style dict for the line collections (the bars), ejecting any
3371
3371
# marker information from format string.
3372
3372
eb_lines_style = dict (base_style )
@@ -3411,11 +3411,6 @@ def errorbar(self, x, y, yerr=None, xerr=None,
3411
3411
eb_cap_style [key ] = kwargs [key ]
3412
3412
eb_cap_style ['color' ] = ecolor
3413
3413
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
-
3419
3414
barcols = []
3420
3415
caplines = []
3421
3416
0 commit comments