On 7/14/07, Adam Mercer <[EMAIL PROTECTED]> wrote: > On 14/07/07, John Hunter <[EMAIL PROTECTED]> wrote: > > > OK, the problem with this code is fill expects the vertices of the > > polygon you want filled and you are only providing the top part, not > > the bottom. The modified version of your code fills between your line > > and the bottom of zero > > Thanks John, that works great!
You're welcome. If you are a svn user, I added a more efficient poly_between to matplotlib.mlab and updated the fill_between.py example, which shows filling below, above and between. def poly_between(x, ylower, yupper): """ given a sequence of x, ylower and yupper, return the polygon that fills the regions between them. ylower or yupper can be scalar or iterable. If they are iterable, they must be equal in length to x return value is x, y arrays for use with Axes.fill """ Nx = len(x) if not iterable(ylower): ylower = ylower*npy.ones(Nx) if not iterable(yupper): yupper = yupper*npy.ones(Nx) x = npy.concatenate( (x, x[::-1]) ) y = npy.concatenate( (yupper, ylower[::-1]) ) return x,y ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users