Creating Pie Chart from Python
John Hunter
jdhunter at ace.bsd.uchicago.edu
Fri Sep 16 09:18:08 EDT 2005
>>>>> "Thierry" == Thierry Lam <lamthierry at gmail.com> writes:
Thierry> Let's say I have the following data: 500 objects: -100
Thierry> are red -300 are blue -the rest are green
Thierry> Is there some python package which can represen the above
Thierry> information in a pie chart?
It looks like in python there is more than one way to make a pie
chart. Here's another
from pylab import figure, pie, show
N, red, blue = 500, 100, 300
green = N - (red + blue)
figure(figsize=(6,6))
pie( (red, blue, green),
labels=('red', 'blue', 'green'),
colors=('red', 'blue', 'green'),)
show()
A screenshot of a slightly more elaborate example is at
http://matplotlib.sourceforge.net/screenshots.html#pie_demo
JDH
More information about the Python-list
mailing list