I recently discovered Google Chart API. From URLs it is able to generate image files with plots of different sorts, e.g., line plots, pie charts or even QR codes. The pie chart here was generated with the following code:
du -sk /usr/* > stats.txt ; python -c "d = open('stats.txt').read().split(); s = sum(map(float, d[0::2])); print('http://chart.apis.google.com/chart?cht=p&chd=t:' + ','.join(map(lambda x : str(int(float(x)/s*100)),d[0::2])) + '&chs=600x300&chl=' + '|'.join(d[1::2]));"
Copy and pasting the returned URL into a Web-browser will show the Google-generated pie chart as PNG. Alternatively one could let Python download the file by modifying the code to use ‘urllib.urlretrieve()’.
For the data in the ‘chd’ parameter it seems that one needs to indicate the percentage.
There is also a module called pycha, which I haven’t tried.