@@ -2824,6 +2824,14 @@ def xywhere(xs, ys, mask):
28242824 right = [thisx + thiserr for (thisx , thiserr )
28252825 in cbook .safezip (x , xerr [1 ])]
28262826 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." )
28272835 # using list comps rather than arrays to preserve units
28282836 left = [thisx - thiserr for (thisx , thiserr )
28292837 in cbook .safezip (x , xerr )]
@@ -2882,6 +2890,12 @@ def xywhere(xs, ys, mask):
28822890 upper = [thisy + thiserr for (thisy , thiserr )
28832891 in cbook .safezip (y , yerr [1 ])]
28842892 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." )
28852899 # using list comps rather than arrays to preserve units
28862900 lower = [thisy - thiserr for (thisy , thiserr )
28872901 in cbook .safezip (y , yerr )]
0 commit comments