why do i'm getting ovelapping pie plot in python
<p>I am walking along a directory using <code>walk</code> function > searching for a .cnt file > counting interested value > plotting 'em in a pie chart. But the problem is when my prog processes for the first folder and plots, it acts fine.But after that whatever folder it reads and plots it get overlapped. Can't understand if bug in my code. I used like:</p>

<pre><code>for root,dirs,files in os.walk(path):
    aspCount = 0
    gluCount = 0
    aspCountCol1 = 0
    aspCountCol2 = 0
    gluCountCol1 = 0
    gluCountCol2 = 0

    listOfFile = glob.iglob(os.path.join(root,'*.cnt'))
    for filename in listOfFile:
        inp = open(filename,'r').read().strip().split('\n')
        for line in map(str.split,inp):

            k = line[-1]
            m = line[0]
            if k == 'ASP':
               aspCountCol1 += 1
            elif m == 'ASP':
               aspCountCol2 += 1
            if k == 'GLU':
               gluCountCol1 += 1
            elif m == 'GLU'
               gluCountCol1 +=1
                     # here lies the problem for me !!!!
        aspCount = aspCountCol1 + aspCountCol1
        gluCount = gluCountCol1 + gluCountCol1
        #now plotting......
        from pylab import *
        figure(1, (figsize=(8,8))
        labels = 'asp','glu'
        fracs = [asp_count,glu_count]
        pie(fracs,explode=None,labels=labels,autopct='%1.1f%%',shadow=False)
        c = 'fig.png'
        savefig(os.path.join(root,c))
</code></pre>

<p>now, the problem is: with this code if i process a directory with various sub-folders containing .cnt file, it goes error free. But the graph generated by the first folder, it be fine but when prog goes to process the next folder it sucessfully process the data but the graph generated is overlapped with the previous one.<br>
the file i was processing was:  </p>

<pre><code>LYS  ARG
ASP  GLU
GLU  SAP
JAS  ASP
SAK  GLU
</code></pre>
