@@ -2602,7 +2602,9 @@ def errorbar(self, x, y, yerr=None, xerr=None,
2602
2602
These arguments can be used to indicate that a value gives
2603
2603
only upper/lower limits. In that case a caret symbol is
2604
2604
used to indicate this. lims-arguments may be of the same
2605
- type as *xerr* and *yerr*.
2605
+ type as *xerr* and *yerr*. To use limits with inverted
2606
+ axes, :meth:`set_xlim` or :meth:`set_ylim` must be called
2607
+ before :meth:`errorbar`.
2606
2608
2607
2609
*errorevery*: positive integer
2608
2610
subsamples the errorbars. e.g., if everyerror=5, errorbars for
@@ -2754,7 +2756,7 @@ def xywhere(xs, ys, mask):
2754
2756
right = [thisx + thiserr for (thisx , thiserr )
2755
2757
in cbook .safezip (x , xerr )]
2756
2758
2757
- # select points without upper/lower limits in x
2759
+ # select points without upper/lower limits in x and
2758
2760
# draw normal errorbars for these points
2759
2761
noxlims = ~ (xlolims | xuplims )
2760
2762
if noxlims .any ():
@@ -2770,9 +2772,13 @@ def xywhere(xs, ys, mask):
2770
2772
lo , ro = xywhere (x , right , xlolims & everymask )
2771
2773
barcols .append (self .hlines (yo , lo , ro , ** lines_kw ))
2772
2774
rightup , yup = xywhere (right , y , xlolims & everymask )
2775
+ if self .xaxis_inverted ():
2776
+ marker = mlines .CARETLEFT
2777
+ else :
2778
+ marker = mlines .CARETRIGHT
2773
2779
caplines .extend (
2774
- self .plot (rightup , yup , ls = 'None' ,
2775
- marker = mlines . CARETRIGHT , ** plot_kw ))
2780
+ self .plot (rightup , yup , ls = 'None' , marker = marker ,
2781
+ ** plot_kw ))
2776
2782
if capsize > 0 :
2777
2783
xlo , ylo = xywhere (x , y , xlolims & everymask )
2778
2784
caplines .extend (self .plot (xlo , ylo , 'k|' , ** plot_kw ))
@@ -2782,9 +2788,13 @@ def xywhere(xs, ys, mask):
2782
2788
lo , ro = xywhere (left , x , xuplims & everymask )
2783
2789
barcols .append (self .hlines (yo , lo , ro , ** lines_kw ))
2784
2790
leftlo , ylo = xywhere (left , y , xuplims & everymask )
2791
+ if self .xaxis_inverted ():
2792
+ marker = mlines .CARETRIGHT
2793
+ else :
2794
+ marker = mlines .CARETLEFT
2785
2795
caplines .extend (
2786
- self .plot (leftlo , ylo , ls = 'None' ,
2787
- marker = mlines . CARETLEFT , ** plot_kw ))
2796
+ self .plot (leftlo , ylo , ls = 'None' , marker = marker ,
2797
+ ** plot_kw ))
2788
2798
if capsize > 0 :
2789
2799
xup , yup = xywhere (x , y , xuplims & everymask )
2790
2800
caplines .extend (self .plot (xup , yup , 'k|' , ** plot_kw ))
@@ -2804,7 +2814,7 @@ def xywhere(xs, ys, mask):
2804
2814
upper = [thisy + thiserr for (thisy , thiserr )
2805
2815
in cbook .safezip (y , yerr )]
2806
2816
2807
- # select points without upper/lower limits in y
2817
+ # select points without upper/lower limits in y and
2808
2818
# draw normal errorbars for these points
2809
2819
noylims = ~ (lolims | uplims )
2810
2820
if noylims .any ():
@@ -2820,9 +2830,13 @@ def xywhere(xs, ys, mask):
2820
2830
lo , uo = xywhere (y , upper , lolims & everymask )
2821
2831
barcols .append (self .vlines (xo , lo , uo , ** lines_kw ))
2822
2832
xup , upperup = xywhere (x , upper , lolims & everymask )
2833
+ if self .yaxis_inverted ():
2834
+ marker = mlines .CARETDOWN
2835
+ else :
2836
+ marker = mlines .CARETUP
2823
2837
caplines .extend (
2824
- self .plot (xup , upperup , ls = 'None' ,
2825
- marker = mlines . CARETUP , ** plot_kw ))
2838
+ self .plot (xup , upperup , ls = 'None' , marker = marker ,
2839
+ ** plot_kw ))
2826
2840
if capsize > 0 :
2827
2841
xlo , ylo = xywhere (x , y , lolims & everymask )
2828
2842
caplines .extend (self .plot (xlo , ylo , 'k_' , ** plot_kw ))
@@ -2832,9 +2846,13 @@ def xywhere(xs, ys, mask):
2832
2846
lo , uo = xywhere (lower , y , uplims & everymask )
2833
2847
barcols .append (self .vlines (xo , lo , uo , ** lines_kw ))
2834
2848
xlo , lowerlo = xywhere (x , lower , uplims & everymask )
2849
+ if self .yaxis_inverted ():
2850
+ marker = mlines .CARETUP
2851
+ else :
2852
+ marker = mlines .CARETDOWN
2835
2853
caplines .extend (
2836
- self .plot (xlo , lowerlo , ls = 'None' ,
2837
- marker = mlines . CARETDOWN , ** plot_kw ))
2854
+ self .plot (xlo , lowerlo , ls = 'None' , marker = marker ,
2855
+ ** plot_kw ))
2838
2856
if capsize > 0 :
2839
2857
xup , yup = xywhere (x , y , uplims & everymask )
2840
2858
caplines .extend (self .plot (xup , yup , 'k_' , ** plot_kw ))
0 commit comments