Dear listmembers,

I experienced a problem with matplotlib yesterday that caused me a lot of 
headache and I don't know whether this is a bug or if I forgot something.

What I want is to plot different datasets in different plots in different 
files. My code looks like that:

#######################

from pylab import fft, ifft, var, average, real, show
import matplotlib.pyplot as plt

def process_file(filename, fig_nr):    
    
    plt.figure(fig_nr)
    plt.clf()

    plt.subplot(211)      
    plt.plot(s, alt, '-')
    
    plt.subplot(212) 
    plt.plot(s,map(lambda x: x*3.6,speed))
    
    plt.savefig(filename+".png")
    
    
process_file("foo1.tcx", 1)
process_file("foo2.tcx", 2)
process_file("foo3.tcx",3)

##########################

The problem here is that in the plots for file foo2 the data from foo1 is 
included, in the plots for foo3 the data of foo1 and foo2.

I thought that I paid respect to this behaviour with plt.figure(), on 
stackoverflow I read about the plt.clf() - thing but nothing happened. I tried 
to make fig_nr a hash over the filename or leave it blank (like suggested in 
the documentation) but this had no effect and I ended up with the additional 
parameter (fig_nr in the example above) which also did not work.

Is this maybe a bug or did I forget an important thing?

I'm running Debian sid with python-matplotlib 0.99.1.2-2 (I hope the numbering 
from Debian and matplotlib is similar).

Best regards,
Philipp Bender

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to