On 5/6/07, Jouni K. Seppänen <[EMAIL PROTECTED]> wrote: > Tommy Grav <[EMAIL PROTECTED]> writes: > > > I would now like to plot a vs e for all the obj objects in nlist. > > how do I do that? I tried > > > > plot(nlist[:].a,nlist[:].e,'ko') > > You have a list of objects that have attributes named a and e; these > are not attributes of the list. Try > > plot([x.a for x in nlist], [x.e for x in nlist], 'ko')
Another idiom which I use a lot a,e = zip(*[(o.a, o.e) for o in nlist]) or if I have a lot of attributes I want dumped into arrays a,b,c,d = map(numpy.asarray, zip(*[(o.a, o.b, o.c, o.d) for o in data])) JDH ------------------------------------------------------------------------- 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