In fact, this is one of the things that annoys me with a mistake: it is very subtle in terms of the shape and dimension of the inputs.
I assume that you want error strings, but want their locations to be set with absolute upper and lower bounds, rather than the symmetric error value.
What is errorbar does zip together (using safezip) your y array and yerr [0] for the lower bound (yerr [1] for the upper). So your y and yerr [0] (and [1]) should be arrays of the same size, shape and number of dimensions. Yerr itself should not be an array at all.
The first code you have will work if x, y, ymin and ymax are all one-dimensional arrays, which is what should be. It seems like you haven't.
However, it is important to note that since errorbar yerr is the number of errors, not the absolute limits, you need to add and subtract y from your actual lower and upper limits.
For example:
x = array([1,2,3,4]) y = array([1,2,3,4]) ymin = array([0,1,2,3]) ymax = array([3,4,5,6]) ytop = ymax-y ybot = y-ymin
Let me know if I misinterpret something. It would be nice if you could post some sample data in the form you use.
cge
source share