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