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

Reply via email to