Re: [Matplotlib-users] Clearing A Figure (I Know That This Has Been Posted Before But I Does Not Work For Me)
w/o seeing the entire code it is difficult to diagnose. Nothing looks wrong with your code. However, for full control I suggest you use the API; see examples at http://matplotlib.sourceforge.net/examples/api/index.html and take a look at the artist tutorial at http://matplotlib.sourceforge.net/users/artists.html. Thank you. The tutorial was very helpful. For a moment I thought I might have found the answer with the lines.remove() function but alas, it did not make a difference yet again. :( I am starting to feel that this is a problem with my setup rather than my code. I may have to try this on someone else's computer. In a nutshell fig = plt.figure() ax = fig.add_subplot(111) for param in myparams: fig.clf() ax.plot(something_with(param)) ax.set_ylabel('Sum Squared Error') ax.set_title('Plot of Iris Training Errors') ax.set_ylim(ymin=0) outfilename = '%d.png'%param fig.savefig(outfilename) This is almost exactly the same as something else I have tried but this is all to no avail. I have posted all of my code at http://code-bin.homedns.org/653 if anyone has time to look at it. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- View this message in context: http://old.nabble.com/Clearing-A-Figure-%28I-Know-That-This-Has-Been-Posted-Before-But-I-Does-Not-Work-For-Me%29-tp28665976p28678426.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Clearing A Figure (I Know That This Has Been Posted Before But I Does Not Work For Me)
I am attempting to run a lot of tests automatically and generate a graph for each one. However, at the moment, the previous graph remains on the figure and the next plot is drawn over it. I have read extensively the documentation and I have tried a whole lot of different commands but to no avail. In the previous post it said to use pylab.clf() which is exactly what I've been trying to use. So far I have used pylab.cla(), pylab.clf() and pylab.close() although I believe that this only closes an open figure window. I have no idea why it is not working now especially since it would appear that my question had already been answered in both the documentation and the forums. I am using Python 2.6.4 on Ubuntu Linux. Here is the relevant code I am using: pylab.plot(xAxis, TrainingPoints, 'b-') pylab.plot(xAxis, TestPoints, 'r-') pylab.xlabel('Epochs') pylab.ylabel('Sum Squared Error') pylab.title('Plot of Iris Training Errors') outfilename = str(int(LEARNING_RATE)) + .png print outfilename pylab.ylim(ymin=0) pylab.savefig(outfilename) pylab.cla() pylab.clf() I really hope one of you can spot an error otherwise I am completely stuck. -- View this message in context: http://old.nabble.com/Clearing-A-Figure-%28I-Know-That-This-Has-Been-Posted-Before-But-I-Does-Not-Work-For-Me%29-tp28665976p28665976.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Clearing A Figure (I Know That This Has Been Posted Before But I Does Not Work For Me)
On Tue, May 25, 2010 at 4:08 AM, Thistleryver mhar...@ec.auckland.ac.nz wrote: I am attempting to run a lot of tests automatically and generate a graph for each one. However, at the moment, the previous graph remains on the figure and the next plot is drawn over it. I have read extensively the documentation and I have tried a whole lot of different commands but to no avail. In the previous post it said to use pylab.clf() which is exactly what I've been trying to use. So far I have used pylab.cla(), pylab.clf() and pylab.close() although I believe that this only closes an open figure window. I have no idea why it is not working now especially since it would appear that my question had already been answered in both the documentation and the forums. I am using Python 2.6.4 on Ubuntu Linux. Here is the relevant code I am using: pylab.plot(xAxis, TrainingPoints, 'b-') pylab.plot(xAxis, TestPoints, 'r-') pylab.xlabel('Epochs') pylab.ylabel('Sum Squared Error') pylab.title('Plot of Iris Training Errors') outfilename = str(int(LEARNING_RATE)) + .png print outfilename pylab.ylim(ymin=0) pylab.savefig(outfilename) pylab.cla() pylab.clf() w/o seeing the entire code it is difficult to diagnose. Nothing looks wrong with your code. However, for full control I suggest you use the API; see examples at http://matplotlib.sourceforge.net/examples/api/index.html and take a look at the artist tutorial at http://matplotlib.sourceforge.net/users/artists.html. In a nutshell fig = plt.figure() ax = fig.add_subplot(111) for param in myparams: fig.clf() ax.plot(something_with(param)) ax.set_ylabel('Sum Squared Error') ax.set_title('Plot of Iris Training Errors') ax.set_ylim(ymin=0) outfilename = '%d.png'%param fig.savefig(outfilename) -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users