From: Pierre GM <pgm...@gm...> - 2008-02-10 17:49:31
|
On Sunday 10 February 2008 12:40:38 David Trémouilles wrote: > I have a slightly different objective: I just want to remove outliers > from my curves. I think I will still play with maskedarray and used the > compressed() function before 'sending' to matplotlib. > Any comments on that, any other idea? So, you have two arrays x and y, with missing values in y that you don't want to plot ? Assuming that your arrays are 1D, you can try something like: plot(x[logical_not(y.mask)], y.compressed()) in order to ensure that the x and y to be plotted have the same size. Note that in this simple case, you don't need masked arrays, you just want to plot point satisfying a given condition, right ? So: condition = (y>=min_value) & (y<= max_value) plot(x[condition],y[condition]) will give the same results. |