|
3 | 3 |
|
4 | 4 | import six |
5 | 5 | from six.moves import reduce, xrange, zip |
6 | | - |
| 6 | +import itertools |
7 | 7 | import math |
8 | 8 | import warnings |
9 | 9 |
|
|
36 | 36 | import matplotlib.transforms as mtransforms |
37 | 37 | import matplotlib.tri as mtri |
38 | 38 | import matplotlib.transforms as mtrans |
39 | | -from matplotlib.container import BarContainer, ErrorbarContainer, StemContainer |
| 39 | +from matplotlib.container import (BarContainer, ErrorbarContainer, |
| 40 | + StemContainer, Container) |
40 | 41 | from matplotlib.axes._base import _AxesBase |
41 | 42 | from matplotlib.axes._base import _process_plot_format |
42 | 43 |
|
@@ -2758,7 +2759,7 @@ def xywhere(xs, ys, mask): |
2758 | 2759 |
|
2759 | 2760 | if xerr is not None: |
2760 | 2761 | if (iterable(xerr) and len(xerr) == 2 and |
2761 | | - iterable(xerr[0]) and iterable(xerr[1])): |
| 2762 | + iterable(xerr[0]) and iterable(xerr[1])): |
2762 | 2763 | # using list comps rather than arrays to preserve units |
2763 | 2764 | left = [thisx - thiserr for (thisx, thiserr) |
2764 | 2765 | in cbook.safezip(x, xerr[0])] |
@@ -2889,14 +2890,18 @@ def xywhere(xs, ys, mask): |
2889 | 2890 | self.autoscale_view() |
2890 | 2891 | self._hold = holdstate |
2891 | 2892 |
|
2892 | | - errorbar_container = ErrorbarContainer((l0, tuple(caplines), |
2893 | | - tuple(barcols)), |
| 2893 | + # hack to put these artist in the right place in the |
| 2894 | + # draw tree |
| 2895 | + for ll in itertools.chain((l0, ), caplines, barcols): |
| 2896 | + ll.remove() |
| 2897 | + |
| 2898 | + errorbar_container = ErrorbarContainer((l0, |
| 2899 | + Container(caplines), |
| 2900 | + Container(barcols)), |
2894 | 2901 | has_xerr=(xerr is not None), |
2895 | 2902 | has_yerr=(yerr is not None), |
2896 | 2903 | label=label) |
2897 | | - self.containers.append(errorbar_container) |
2898 | | - |
2899 | | - return errorbar_container # (l0, caplines, barcols) |
| 2904 | + return self.add_container(errorbar_container) |
2900 | 2905 |
|
2901 | 2906 | def boxplot(self, x, notch=False, sym=None, vert=True, whis=1.5, |
2902 | 2907 | positions=None, widths=None, patch_artist=False, |
|
0 commit comments