@@ -3131,43 +3131,36 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
3131
3131
if not len (x ) == len (y ) == len (z ):
3132
3132
raise ValueError ("'x', 'y', and 'z' must have the same size" )
3133
3133
3134
- plot_line = (fmt .lower () != 'none' )
3135
3134
label = kwargs .pop ("label" , None )
3136
-
3137
- if fmt == '' :
3138
- fmt_style_kwargs = {}
3135
+ kwargs ['label' ] = '_nolegend_'
3136
+
3137
+ # Create the main line and determine overall kwargs for child artists.
3138
+ # We avoid calling self.plot() directly, or self._get_lines(), because
3139
+ # that would call self._process_unit_info again, and do other indirect
3140
+ # data processing.
3141
+ (data_line , base_style ), = self ._get_lines ._plot_args (
3142
+ (x , y ) if fmt == '' else (x , y , fmt ), kwargs , return_kwargs = True )
3143
+ art3d .line_2d_to_3d (data_line , zs = z )
3144
+
3145
+ # Do this after creating `data_line` to avoid modifying `base_style`.
3146
+ if barsabove :
3147
+ data_line .set_zorder (kwargs ['zorder' ] - .1 )
3139
3148
else :
3140
- fmt_style_kwargs = {k : v for k , v in
3141
- zip (('linestyle' , 'marker' , 'color' ),
3142
- _process_plot_format (fmt ))
3143
- if v is not None }
3144
-
3145
- if fmt == 'none' :
3146
- # Remove alpha=0 color that _process_plot_format returns
3147
- fmt_style_kwargs .pop ('color' )
3148
-
3149
- if ('color' in kwargs or 'color' in fmt_style_kwargs ):
3150
- base_style = {}
3151
- if 'color' in kwargs :
3152
- base_style ['color' ] = kwargs .pop ('color' )
3149
+ data_line .set_zorder (kwargs ['zorder' ] + .1 )
3150
+
3151
+ # Add line to plot, or throw it away and use it to determine kwargs.
3152
+ if fmt .lower () != 'none' :
3153
+ self .add_line (data_line )
3153
3154
else :
3154
- base_style = next (self ._get_lines .prop_cycler )
3155
+ data_line = None
3156
+ # Remove alpha=0 color that _process_plot_format returns.
3157
+ base_style .pop ('color' )
3155
3158
3156
- base_style ['label' ] = '_nolegend_'
3157
- base_style .update (fmt_style_kwargs )
3158
3159
if 'color' not in base_style :
3159
3160
base_style ['color' ] = 'C0'
3160
3161
if ecolor is None :
3161
3162
ecolor = base_style ['color' ]
3162
3163
3163
- # make the style dict for the 'normal' plot line
3164
- plot_line_style = {
3165
- ** base_style ,
3166
- ** kwargs ,
3167
- 'zorder' : (kwargs ['zorder' ] - .1 if barsabove else
3168
- kwargs ['zorder' ] + .1 ),
3169
- }
3170
-
3171
3164
# Eject any marker information from line format string, as it's not
3172
3165
# needed for bars or caps.
3173
3166
base_style .pop ('marker' , None )
@@ -3199,11 +3192,6 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
3199
3192
eb_cap_style ['markeredgewidth' ] = capthick
3200
3193
eb_cap_style ['color' ] = ecolor
3201
3194
3202
- data_line = None
3203
- if plot_line :
3204
- data_line = art3d .Line3D (x , y , z , ** plot_line_style )
3205
- self .add_line (data_line )
3206
-
3207
3195
everymask = np .zeros (len (x ), bool )
3208
3196
everymask [offset ::errorevery ] = True
3209
3197
0 commit comments