@@ -2785,9 +2785,9 @@ def errorbar(self, x, y, yerr=None, xerr=None,
2785
2785
2786
2786
if fmt is None :
2787
2787
fmt = 'none'
2788
- msg = ('Use of None object as fmt keyword argument to '
2789
- + 'suppress plotting of data values is deprecated '
2790
- + 'since 1.4; use the string "none" instead.' )
2788
+ msg = ('Use of None object as fmt keyword argument to ' +
2789
+ 'suppress plotting of data values is deprecated ' +
2790
+ 'since 1.4; use the string "none" instead.' )
2791
2791
warnings .warn (msg , mplDeprecation , stacklevel = 1 )
2792
2792
2793
2793
plot_line = (fmt .lower () != 'none' )
@@ -2800,11 +2800,12 @@ def errorbar(self, x, y, yerr=None, xerr=None,
2800
2800
if ('color' in kwargs or 'color' in fmt_style_kwargs or
2801
2801
ecolor is not None ):
2802
2802
base_style = {}
2803
+ if 'color' in kwargs :
2804
+ base_style ['color' ] = kwargs .pop ('color' )
2803
2805
else :
2804
2806
base_style = six .next (self ._get_lines .prop_cycler )
2805
2807
2806
2808
base_style ['label' ] = '_nolegend_'
2807
- base_style ['color' ] = kwargs .pop ('color' )
2808
2809
base_style .update (fmt_style_kwargs )
2809
2810
if ecolor is not None :
2810
2811
base_style ['color' ] = ecolor
@@ -2835,12 +2836,15 @@ def errorbar(self, x, y, yerr=None, xerr=None,
2835
2836
# in python3.5+ this can be simplified
2836
2837
eb_style = dict (base_style )
2837
2838
eb_style .update (** kwargs )
2838
- l0 , = self .plot (x , y , ** eb_style )
2839
+ l0 = mlines .Line2D (x , y , ** eb_style )
2840
+ self .add_line (l0 )
2839
2841
2840
2842
barcols = []
2841
2843
caplines = []
2842
2844
2843
2845
lines_kw = dict (base_style )
2846
+ lines_kw .pop ('marker' , None )
2847
+ lines_kw .pop ('linestyle' , None )
2844
2848
if elinewidth :
2845
2849
lines_kw ['linewidth' ] = elinewidth
2846
2850
else :
@@ -2854,9 +2858,9 @@ def errorbar(self, x, y, yerr=None, xerr=None,
2854
2858
# arrays fine here, they are booleans and hence not units
2855
2859
def _bool_asarray_helper (d , expected ):
2856
2860
if not iterable (d ):
2857
- lolims = np .asarray ([d ] * expected , bool )
2861
+ return np .asarray ([d ] * expected , bool )
2858
2862
else :
2859
- lolims = np .asarray (lolims , bool )
2863
+ return np .asarray (lolims , bool )
2860
2864
2861
2865
lolims = _bool_asarray_helper (lolims , len (x ))
2862
2866
uplims = _bool_asarray_helper (uplims , len (x ))
@@ -2929,8 +2933,10 @@ def xywhere(xs, ys, mask):
2929
2933
lo , ro = xywhere (left , right , noxlims & everymask )
2930
2934
barcols .append (self .hlines (yo , lo , ro , ** lines_kw ))
2931
2935
if capsize > 0 :
2932
- caplines .extend (self .plot (lo , yo , '|' , ** plot_kw ))
2933
- caplines .extend (self .plot (ro , yo , '|' , ** plot_kw ))
2936
+ caplines .append (mlines .Line2D (lo , yo , marker = '|' ,
2937
+ ** plot_kw ))
2938
+ caplines .append (mlines .Line2D (ro , yo , marker = '|' ,
2939
+ ** plot_kw ))
2934
2940
2935
2941
if xlolims .any ():
2936
2942
yo , _ = xywhere (y , right , xlolims & everymask )
@@ -2941,12 +2947,13 @@ def xywhere(xs, ys, mask):
2941
2947
marker = mlines .CARETLEFTBASE
2942
2948
else :
2943
2949
marker = mlines .CARETRIGHTBASE
2944
- caplines .extend (
2945
- self . plot (rightup , yup , ls = 'None' , marker = marker ,
2946
- ** plot_kw ))
2950
+ caplines .append (
2951
+ mlines . Line2D (rightup , yup , ls = 'None' , marker = marker ,
2952
+ ** plot_kw ))
2947
2953
if capsize > 0 :
2948
2954
xlo , ylo = xywhere (x , y , xlolims & everymask )
2949
- caplines .extend (self .plot (xlo , ylo , '|' , ** plot_kw ))
2955
+ caplines .append (mlines .Line2D (xlo , ylo , marker = '|' ,
2956
+ ** plot_kw ))
2950
2957
2951
2958
if xuplims .any ():
2952
2959
yo , _ = xywhere (y , right , xuplims & everymask )
@@ -2957,12 +2964,13 @@ def xywhere(xs, ys, mask):
2957
2964
marker = mlines .CARETRIGHTBASE
2958
2965
else :
2959
2966
marker = mlines .CARETLEFTBASE
2960
- caplines .extend (
2961
- self . plot (leftlo , ylo , ls = 'None' , marker = marker ,
2962
- ** plot_kw ))
2967
+ caplines .append (
2968
+ mlines . Line2D (leftlo , ylo , ls = 'None' , marker = marker ,
2969
+ ** plot_kw ))
2963
2970
if capsize > 0 :
2964
2971
xup , yup = xywhere (x , y , xuplims & everymask )
2965
- caplines .extend (self .plot (xup , yup , '|' , ** plot_kw ))
2972
+ caplines .append (mlines .Line2D (xup , yup , marker = '|' ,
2973
+ ** plot_kw ))
2966
2974
2967
2975
if yerr is not None :
2968
2976
if (iterable (yerr ) and len (yerr ) == 2 and
@@ -2993,8 +3001,10 @@ def xywhere(xs, ys, mask):
2993
3001
lo , uo = xywhere (lower , upper , noylims & everymask )
2994
3002
barcols .append (self .vlines (xo , lo , uo , ** lines_kw ))
2995
3003
if capsize > 0 :
2996
- caplines .extend (self .plot (xo , lo , '_' , ** plot_kw ))
2997
- caplines .extend (self .plot (xo , uo , '_' , ** plot_kw ))
3004
+ caplines .append (mlines .Line2D (xo , lo , marker = '_' ,
3005
+ ** plot_kw ))
3006
+ caplines .append (mlines .Line2D (xo , uo , marker = '_' ,
3007
+ ** plot_kw ))
2998
3008
2999
3009
if lolims .any ():
3000
3010
xo , _ = xywhere (x , lower , lolims & everymask )
@@ -3005,12 +3015,13 @@ def xywhere(xs, ys, mask):
3005
3015
marker = mlines .CARETDOWNBASE
3006
3016
else :
3007
3017
marker = mlines .CARETUPBASE
3008
- caplines .extend (
3009
- self . plot (xup , upperup , ls = 'None' , marker = marker ,
3010
- ** plot_kw ))
3018
+ caplines .append (
3019
+ mlines . Line2D (xup , upperup , ls = 'None' , marker = marker ,
3020
+ ** plot_kw ))
3011
3021
if capsize > 0 :
3012
3022
xlo , ylo = xywhere (x , y , lolims & everymask )
3013
- caplines .extend (self .plot (xlo , ylo , 'k_' , ** plot_kw ))
3023
+ caplines .append (mlines .Line2D (xlo , ylo , marker = '_' ,
3024
+ ** plot_kw ))
3014
3025
3015
3026
if uplims .any ():
3016
3027
xo , _ = xywhere (x , lower , uplims & everymask )
@@ -3021,20 +3032,25 @@ def xywhere(xs, ys, mask):
3021
3032
marker = mlines .CARETUPBASE
3022
3033
else :
3023
3034
marker = mlines .CARETDOWNBASE
3024
- caplines .extend (
3025
- self . plot (xlo , lowerlo , ls = 'None' , marker = marker ,
3026
- ** plot_kw ))
3035
+ caplines .append (
3036
+ mlines . Line2D (xlo , lowerlo , ls = 'None' , marker = marker ,
3037
+ ** plot_kw ))
3027
3038
if capsize > 0 :
3028
3039
xup , yup = xywhere (x , y , uplims & everymask )
3029
- caplines .extend (self .plot (xup , yup , 'k_' , ** plot_kw ))
3040
+ caplines .append (mlines .Line2D (xup , yup , marker = '_' ,
3041
+ ** plot_kw ))
3042
+ for l in caplines :
3043
+ self .add_line (l )
3030
3044
3031
3045
if not barsabove and plot_line :
3032
- l0 , = self .plot (x , y , fmt , label = '_nolegend_' , ** kwargs )
3046
+ # in python3.5+ this can be simplified
3047
+ eb_style = dict (base_style )
3048
+ eb_style .update (** kwargs )
3049
+ l0 = mlines .Line2D (x , y , ** eb_style )
3050
+ self .add_line (l0 )
3033
3051
3034
3052
for l in barcols :
3035
3053
l .set_color (ecolor )
3036
- for l in caplines :
3037
- l .set_color (ecolor )
3038
3054
3039
3055
self .autoscale_view ()
3040
3056
self ._hold = holdstate
0 commit comments