i have a .txt file containing data like:
He: 22.1
Ar: 21.1
K: 1.22
U: 0.09
P: 22.0
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:
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)
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.