|
27 | 27 | import matplotlib.container as mcontainer |
28 | 28 | import matplotlib.transforms as mtransforms |
29 | 29 | from matplotlib.axes import Axes, rcParams |
30 | | -from matplotlib.axes._base import _axis_method_wrapper, _process_plot_format |
| 30 | +from matplotlib.axes._base import _axis_method_wrapper |
31 | 31 | from matplotlib.transforms import Bbox |
32 | 32 | from matplotlib.tri.triangulation import Triangulation |
33 | 33 |
|
@@ -3125,43 +3125,36 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='', |
3125 | 3125 | if not len(x) == len(y) == len(z): |
3126 | 3126 | raise ValueError("'x', 'y', and 'z' must have the same size") |
3127 | 3127 |
|
3128 | | - plot_line = (fmt.lower() != 'none') |
3129 | 3128 | 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) |
3133 | 3142 | 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) |
3147 | 3148 | 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') |
3149 | 3152 |
|
3150 | | - base_style['label'] = '_nolegend_' |
3151 | | - base_style.update(fmt_style_kwargs) |
3152 | 3153 | if 'color' not in base_style: |
3153 | 3154 | base_style['color'] = 'C0' |
3154 | 3155 | if ecolor is None: |
3155 | 3156 | ecolor = base_style['color'] |
3156 | 3157 |
|
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 | | - |
3165 | 3158 | # Eject any marker information from line format string, as it's not |
3166 | 3159 | # needed for bars or caps. |
3167 | 3160 | base_style.pop('marker', None) |
@@ -3193,11 +3186,6 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='', |
3193 | 3186 | eb_cap_style['markeredgewidth'] = capthick |
3194 | 3187 | eb_cap_style['color'] = ecolor |
3195 | 3188 |
|
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 | | - |
3201 | 3189 | everymask = np.zeros(len(x), bool) |
3202 | 3190 | everymask[offset::errorevery] = True |
3203 | 3191 |
|
|
0 commit comments