@@ -3124,43 +3124,36 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
31243124 if not len (x ) == len (y ) == len (z ):
31253125 raise ValueError ("'x', 'y', and 'z' must have the same size" )
31263126
3127- plot_line = (fmt .lower () != 'none' )
31283127 label = kwargs .pop ("label" , None )
3129-
3130- if fmt == '' :
3131- fmt_style_kwargs = {}
3128+ kwargs ['label' ] = '_nolegend_'
3129+
3130+ # Create the main line and determine overall kwargs for child artists.
3131+ # We avoid calling self.plot() directly, or self._get_lines(), because
3132+ # that would call self._process_unit_info again, and do other indirect
3133+ # data processing.
3134+ (data_line , base_style ), = self ._get_lines ._plot_args (
3135+ (x , y ) if fmt == '' else (x , y , fmt ), kwargs , return_kwargs = True )
3136+ art3d .line_2d_to_3d (data_line , zs = z )
3137+
3138+ # Do this after creating `data_line` to avoid modifying `base_style`.
3139+ if barsabove :
3140+ data_line .set_zorder (kwargs ['zorder' ] - .1 )
31323141 else :
3133- fmt_style_kwargs = {k : v for k , v in
3134- zip (('linestyle' , 'marker' , 'color' ),
3135- _process_plot_format (fmt ))
3136- if v is not None }
3137-
3138- if fmt == 'none' :
3139- # Remove alpha=0 color that _process_plot_format returns
3140- fmt_style_kwargs .pop ('color' )
3141-
3142- if ('color' in kwargs or 'color' in fmt_style_kwargs ):
3143- base_style = {}
3144- if 'color' in kwargs :
3145- base_style ['color' ] = kwargs .pop ('color' )
3142+ data_line .set_zorder (kwargs ['zorder' ] + .1 )
3143+
3144+ # Add line to plot, or throw it away and use it to determine kwargs.
3145+ if fmt .lower () != 'none' :
3146+ self .add_line (data_line )
31463147 else :
3147- base_style = next (self ._get_lines .prop_cycler )
3148+ data_line = None
3149+ # Remove alpha=0 color that _process_plot_format returns.
3150+ base_style .pop ('color' )
31483151
3149- base_style ['label' ] = '_nolegend_'
3150- base_style .update (fmt_style_kwargs )
31513152 if 'color' not in base_style :
31523153 base_style ['color' ] = 'C0'
31533154 if ecolor is None :
31543155 ecolor = base_style ['color' ]
31553156
3156- # make the style dict for the 'normal' plot line
3157- plot_line_style = {
3158- ** base_style ,
3159- ** kwargs ,
3160- 'zorder' : (kwargs ['zorder' ] - .1 if barsabove else
3161- kwargs ['zorder' ] + .1 ),
3162- }
3163-
31643157 # Eject any marker information from line format string, as it's not
31653158 # needed for bars or caps.
31663159 base_style .pop ('marker' , None )
@@ -3192,11 +3185,6 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
31923185 eb_cap_style ['markeredgewidth' ] = capthick
31933186 eb_cap_style ['color' ] = ecolor
31943187
3195- data_line = None
3196- if plot_line :
3197- data_line = art3d .Line3D (x , y , z , ** plot_line_style )
3198- self .add_line (data_line )
3199-
32003188 everymask = np .zeros (len (x ), bool )
32013189 everymask [offset ::errorevery ] = True
32023190
0 commit comments