@@ -2824,6 +2824,14 @@ def xywhere(xs, ys, mask):
2824
2824
right = [thisx + thiserr for (thisx , thiserr )
2825
2825
in cbook .safezip (x , xerr [1 ])]
2826
2826
else :
2827
+ # Check if xerr is scalar or symmetric. Asymmetric is handled
2828
+ # above. This prevents Nx2 arrays from accidentally
2829
+ # being accepted, when the user meant the 2xN transpose.
2830
+ if not (len (xerr ) == 1 or
2831
+ (len (xerr ) == len (x ) and not (
2832
+ iterable (xerr [0 ]) and len (xerr [0 ]) > 1 ))):
2833
+ raise ValueError ("xerr must be a scalar, the same "
2834
+ "dimensions as x, or 2xN." )
2827
2835
# using list comps rather than arrays to preserve units
2828
2836
left = [thisx - thiserr for (thisx , thiserr )
2829
2837
in cbook .safezip (x , xerr )]
@@ -2882,6 +2890,12 @@ def xywhere(xs, ys, mask):
2882
2890
upper = [thisy + thiserr for (thisy , thiserr )
2883
2891
in cbook .safezip (y , yerr [1 ])]
2884
2892
else :
2893
+ # Check for scalar or symmetric, as in xerr.
2894
+ if not (len (yerr ) == 1 or
2895
+ (len (yerr ) == len (y ) and not (
2896
+ iterable (yerr [0 ]) and len (yerr [0 ]) > 1 ))):
2897
+ raise ValueError ("yerr must be a scalar, the same "
2898
+ "dimensions as y, or 2xN." )
2885
2899
# using list comps rather than arrays to preserve units
2886
2900
lower = [thisy - thiserr for (thisy , thiserr )
2887
2901
in cbook .safezip (y , yerr )]
0 commit comments