@@ -3175,16 +3175,10 @@ def errorbar(self, x, y, yerr=None, xerr=None,
3175
3175
caplines = []
3176
3176
3177
3177
# arrays fine here, they are booleans and hence not units
3178
- def _bool_asarray_helper (d , expected ):
3179
- if not iterable (d ):
3180
- return np .asarray ([d ] * expected , bool )
3181
- else :
3182
- return np .asarray (d , bool )
3183
-
3184
- lolims = _bool_asarray_helper (lolims , len (x ))
3185
- uplims = _bool_asarray_helper (uplims , len (x ))
3186
- xlolims = _bool_asarray_helper (xlolims , len (x ))
3187
- xuplims = _bool_asarray_helper (xuplims , len (x ))
3178
+ lolims = np .broadcast_to (lolims , len (x )).astype (bool )
3179
+ uplims = np .broadcast_to (uplims , len (x )).astype (bool )
3180
+ xlolims = np .broadcast_to (xlolims , len (x )).astype (bool )
3181
+ xuplims = np .broadcast_to (xuplims , len (x )).astype (bool )
3188
3182
3189
3183
everymask = np .arange (len (x )) % errorevery == 0
3190
3184
@@ -3216,9 +3210,9 @@ def extract_err(err, data):
3216
3210
else :
3217
3211
if iterable (a ) and iterable (b ):
3218
3212
# using list comps rather than arrays to preserve units
3219
- low = [thisx - thiserr for ( thisx , thiserr )
3213
+ low = [thisx - thiserr for thisx , thiserr
3220
3214
in cbook .safezip (data , a )]
3221
- high = [thisx + thiserr for ( thisx , thiserr )
3215
+ high = [thisx + thiserr for thisx , thiserr
3222
3216
in cbook .safezip (data , b )]
3223
3217
return low , high
3224
3218
# Check if xerr is scalar or symmetric. Asymmetric is handled
@@ -3227,13 +3221,13 @@ def extract_err(err, data):
3227
3221
# special case for empty lists
3228
3222
if len (err ) > 1 :
3229
3223
fe = safe_first_element (err )
3230
- if ( len (err ) != len (data ) or np .size (fe ) > 1 ) :
3224
+ if len (err ) != len (data ) or np .size (fe ) > 1 :
3231
3225
raise ValueError ("err must be [ scalar | N, Nx1 "
3232
3226
"or 2xN array-like ]" )
3233
3227
# using list comps rather than arrays to preserve units
3234
- low = [thisx - thiserr for ( thisx , thiserr )
3228
+ low = [thisx - thiserr for thisx , thiserr
3235
3229
in cbook .safezip (data , err )]
3236
- high = [thisx + thiserr for ( thisx , thiserr )
3230
+ high = [thisx + thiserr for thisx , thiserr
3237
3231
in cbook .safezip (data , err )]
3238
3232
return low , high
3239
3233
0 commit comments