draw pie chart(using matplotlib) in python
<p>i have a <code>.txt</code> file containing data like:</p>

<pre><code>He: 22.1
Ar: 21.1
K:  1.22
U:  0.09
P:  22.0
</code></pre>

<p>now what I wanted to do is to plot a pie chart using line 2 to line 4. I have managed to plot a similar one using first 4 lines using this code:</p>

<pre><code>f=open(filename,'r')
line = (f.next() for i in range(4))
pieces = (lin.split(':') for lin in line)
data = (a, float(b)) for a, b in pieces)
labels,values = zip(*data)
plt.pie(values,labels=labels)
</code></pre>

<p>using this code I could managed to draw a similar pie of first 4 lines. But in case of selective plotting using line2 and line4 how do i use slicing here to take desired lines out.</p>
