@@ -2995,7 +2995,7 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
2995
2995
barsabove = False , errorevery = 1 , ecolor = None , elinewidth = None ,
2996
2996
capsize = None , capthick = None , xlolims = False , xuplims = False ,
2997
2997
ylolims = False , yuplims = False , zlolims = False , zuplims = False ,
2998
- arrow_length_ratio = .4 , ** kwargs ):
2998
+ ** kwargs ):
2999
2999
"""
3000
3000
Plot lines and/or markers with errorbars around them.
3001
3001
@@ -3072,10 +3072,6 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
3072
3072
Used to avoid overlapping error bars when two series share x-axis
3073
3073
values.
3074
3074
3075
- arrow_length_ratio : float, default: 0.4
3076
- Passed to :meth:`quiver`, the ratio of the arrow head with respect
3077
- to the quiver.
3078
-
3079
3075
Returns
3080
3076
-------
3081
3077
errlines : list
@@ -3188,7 +3184,7 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
3188
3184
eb_lines_style [key ] = kwargs [key ]
3189
3185
3190
3186
# Make the style dict for caps (the "hats").
3191
- eb_cap_style = {** base_style , 'linestyle' : 'none ' }
3187
+ eb_cap_style = {** base_style , 'linestyle' : 'None ' }
3192
3188
if capsize is None :
3193
3189
capsize = rcParams ["errorbar.capsize" ]
3194
3190
if capsize > 0 :
@@ -3217,14 +3213,8 @@ def _extract_errs(err, data, lomask, himask):
3217
3213
else :
3218
3214
low_err , high_err = err , err
3219
3215
3220
- # for compatibility with the 2d errorbar function, when both upper
3221
- # and lower limits specified, we need to draw the markers / line
3222
- common_mask = (lomask == himask ) & everymask
3223
- _lomask = lomask | common_mask
3224
- _himask = himask | common_mask
3225
-
3226
- lows = np .where (_lomask , data - low_err , data )
3227
- highs = np .where (_himask , data + high_err , data )
3216
+ lows = np .where (lomask | ~ everymask , data , data - low_err )
3217
+ highs = np .where (himask | ~ everymask , data , data + high_err )
3228
3218
3229
3219
return lows , highs
3230
3220
@@ -3259,18 +3249,16 @@ def _extract_errs(err, data, lomask, himask):
3259
3249
lolims = np .broadcast_to (lolims , len (data )).astype (bool )
3260
3250
uplims = np .broadcast_to (uplims , len (data )).astype (bool )
3261
3251
3262
- nolims = ~ (lolims | uplims )
3263
-
3264
3252
# a nested list structure that expands to (xl,xh),(yl,yh),(zl,zh),
3265
3253
# where x/y/z and l/h correspond to dimensions and low/high
3266
3254
# positions of errorbars in a dimension we're looping over
3267
3255
coorderr = [
3268
- _extract_errs (err * dir_vector [i ], coord ,
3269
- ~ lolims & everymask , ~ uplims & everymask )
3256
+ _extract_errs (err * dir_vector [i ], coord , lolims , uplims )
3270
3257
for i , coord in enumerate ([x , y , z ])]
3271
3258
(xl , xh ), (yl , yh ), (zl , zh ) = coorderr
3272
3259
3273
3260
# draws capmarkers - flat caps orthogonal to the error bars
3261
+ nolims = ~ (lolims | uplims )
3274
3262
if nolims .any () and capsize > 0 :
3275
3263
lo_caps_xyz = _apply_mask ([xl , yl , zl ], nolims & everymask )
3276
3264
hi_caps_xyz = _apply_mask ([xh , yh , zh ], nolims & everymask )
@@ -3288,24 +3276,18 @@ def _extract_errs(err, data, lomask, himask):
3288
3276
caplines .append (cap_lo )
3289
3277
caplines .append (cap_hi )
3290
3278
3291
- if (lolims | uplims ).any ():
3292
- limits = [
3293
- _extract_errs (err * dir_vector [i ], coord , uplims , lolims )
3294
- for i , coord in enumerate ([x , y , z ])]
3295
-
3296
- (xlo , xup ), (ylo , yup ), (zlo , zup ) = limits
3297
- lomask = lolims & everymask
3298
- upmask = uplims & everymask
3299
- lolims_xyz = np .array (_apply_mask ([xlo , ylo , zlo ], upmask ))
3300
- uplims_xyz = np .array (_apply_mask ([xup , yup , zup ], lomask ))
3301
- lo_xyz = np .array (_apply_mask ([x , y , z ], upmask ))
3302
- up_xyz = np .array (_apply_mask ([x , y , z ], lomask ))
3303
- x0 , y0 , z0 = np .concatenate ([lo_xyz , up_xyz ], axis = - 1 )
3304
- dx , dy , dz = np .concatenate ([lolims_xyz - lo_xyz ,
3305
- uplims_xyz - up_xyz ], axis = - 1 )
3306
- self .quiver (x0 , y0 , z0 , dx , dy , dz ,
3307
- arrow_length_ratio = arrow_length_ratio ,
3308
- ** eb_lines_style )
3279
+ markersize = eb_cap_style .pop ('markersize' ,
3280
+ rcParams ['lines.markersize' ]) / 30
3281
+ if lolims .any ():
3282
+ xh0 , yh0 , zh0 = _apply_mask ([xh , yh , zh ], lolims & everymask )
3283
+ self .quiver (xh0 , yh0 , zh0 , * dir_vector ,
3284
+ length = markersize , arrow_length_ratio = 1 ,
3285
+ ** eb_cap_style )
3286
+ if uplims .any ():
3287
+ xl0 , yl0 , zl0 = _apply_mask ([xl , yl , zl ], uplims & everymask )
3288
+ self .quiver (xl0 , yl0 , zl0 , * - dir_vector ,
3289
+ length = markersize , arrow_length_ratio = 1 ,
3290
+ ** eb_cap_style )
3309
3291
3310
3292
errline = art3d .Line3DCollection (np .array (coorderr ).T ,
3311
3293
** eb_lines_style )
0 commit comments