From: Imara J. <im...@gm...> - 2006-03-15 16:11:16
|
Thanks! By pairing every figure command with a close, I avoid memory leaks and solv= e my problem. On 3/15/06, John Hunter <jdh...@ac...> wrote: > > >>>>> "Alan" =3D=3D Alan Isaac <ai...@am...> writes: > > Alan> On Wed, 15 Mar 2006, Imara Jarrett wrote: > >> I would like to generate matplotlib scatter plots in a python > >> 'for' loop. > > Alan> Use 'figure'. > > You have to be a little careful here -- remember whenever you are > creating plots in a loop you should pair every figure command with a > close to avoid memory leaks > > for i in somerange: > figure(1) > scatter(mydata, ...) > savefig(myfile) > close(1) > > You have a few other alternatives.... The hold state affects whether > new plot commands to an Axes/Subplot will overwrite the existing one > or add on to it > > scatter(mydata, ..., hold=3DFalse) # clear the existing axes > scatter(mydata, ..., hold=3DTrue) # add to the existing axes > > See also the commands clf (clear current figure) and cla (clear > current axes) > > JDH > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting > language > that extends applications into web and mobile media. Attend the live > webcast > and join the prime developer group breaking into this new coding > territory! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat= =3D121642 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |