|
29 | 29 | import matplotlib.container as mcontainer
|
30 | 30 | import matplotlib.transforms as mtransforms
|
31 | 31 | from matplotlib.axes import Axes, rcParams
|
32 |
| -from matplotlib.axes._base import _axis_method_wrapper, _process_plot_format |
| 32 | +from matplotlib.axes._base import _axis_method_wrapper |
33 | 33 | from matplotlib.transforms import Bbox
|
34 | 34 | from matplotlib.tri.triangulation import Triangulation
|
35 | 35 |
|
@@ -3051,43 +3051,36 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
|
3051 | 3051 | if not len(x) == len(y) == len(z):
|
3052 | 3052 | raise ValueError("'x', 'y', and 'z' must have the same size")
|
3053 | 3053 |
|
3054 |
| - plot_line = (fmt.lower() != 'none') |
3055 | 3054 | label = kwargs.pop("label", None)
|
3056 |
| - |
3057 |
| - if fmt == '': |
3058 |
| - fmt_style_kwargs = {} |
| 3055 | + kwargs['label'] = '_nolegend_' |
| 3056 | + |
| 3057 | + # Create the main line and determine overall kwargs for child artists. |
| 3058 | + # We avoid calling self.plot() directly, or self._get_lines(), because |
| 3059 | + # that would call self._process_unit_info again, and do other indirect |
| 3060 | + # data processing. |
| 3061 | + (data_line, base_style), = self._get_lines._plot_args( |
| 3062 | + (x, y) if fmt == '' else (x, y, fmt), kwargs, return_kwargs=True) |
| 3063 | + art3d.line_2d_to_3d(data_line, zs=z) |
| 3064 | + |
| 3065 | + # Do this after creating `data_line` to avoid modifying `base_style`. |
| 3066 | + if barsabove: |
| 3067 | + data_line.set_zorder(kwargs['zorder'] - .1) |
3059 | 3068 | else:
|
3060 |
| - fmt_style_kwargs = {k: v for k, v in |
3061 |
| - zip(('linestyle', 'marker', 'color'), |
3062 |
| - _process_plot_format(fmt)) |
3063 |
| - if v is not None} |
3064 |
| - |
3065 |
| - if fmt == 'none': |
3066 |
| - # Remove alpha=0 color that _process_plot_format returns |
3067 |
| - fmt_style_kwargs.pop('color') |
3068 |
| - |
3069 |
| - if ('color' in kwargs or 'color' in fmt_style_kwargs): |
3070 |
| - base_style = {} |
3071 |
| - if 'color' in kwargs: |
3072 |
| - base_style['color'] = kwargs.pop('color') |
| 3069 | + data_line.set_zorder(kwargs['zorder'] + .1) |
| 3070 | + |
| 3071 | + # Add line to plot, or throw it away and use it to determine kwargs. |
| 3072 | + if fmt.lower() != 'none': |
| 3073 | + self.add_line(data_line) |
3073 | 3074 | else:
|
3074 |
| - base_style = next(self._get_lines.prop_cycler) |
| 3075 | + data_line = None |
| 3076 | + # Remove alpha=0 color that _process_plot_format returns. |
| 3077 | + base_style.pop('color') |
3075 | 3078 |
|
3076 |
| - base_style['label'] = '_nolegend_' |
3077 |
| - base_style.update(fmt_style_kwargs) |
3078 | 3079 | if 'color' not in base_style:
|
3079 | 3080 | base_style['color'] = 'C0'
|
3080 | 3081 | if ecolor is None:
|
3081 | 3082 | ecolor = base_style['color']
|
3082 | 3083 |
|
3083 |
| - # make the style dict for the 'normal' plot line |
3084 |
| - plot_line_style = { |
3085 |
| - **base_style, |
3086 |
| - **kwargs, |
3087 |
| - 'zorder': (kwargs['zorder'] - .1 if barsabove else |
3088 |
| - kwargs['zorder'] + .1), |
3089 |
| - } |
3090 |
| - |
3091 | 3084 | # Eject any marker information from line format string, as it's not
|
3092 | 3085 | # needed for bars or caps.
|
3093 | 3086 | base_style.pop('marker', None)
|
@@ -3119,11 +3112,6 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
|
3119 | 3112 | eb_cap_style['markeredgewidth'] = capthick
|
3120 | 3113 | eb_cap_style['color'] = ecolor
|
3121 | 3114 |
|
3122 |
| - data_line = None |
3123 |
| - if plot_line: |
3124 |
| - data_line = art3d.Line3D(x, y, z, **plot_line_style) |
3125 |
| - self.add_line(data_line) |
3126 |
| - |
3127 | 3115 | everymask = np.zeros(len(x), bool)
|
3128 | 3116 | everymask[offset::errorevery] = True
|
3129 | 3117 |
|
|
0 commit comments