Thursday, May 9, 2013

PL#7: Pie chart in python


#! /usr/local/bin/python

from pylab import *

figure(1, figsize=(4,4))
axes([0.1, 0.1, 0.8, 0.8])

pievar =[60, 30, 20, 10, 5, 2, 3]
pie(pievar)


# with labels, user defined colors
#! /usr/local/bin/python
from pylab import *
figure(1, figsize=(4,4))
axes([0.1, 0.1, 0.8, 0.8])

pievar =[60, 30, 20, 10, 5, 2, 3]
mylab = ["A", "B", "C", "d", "e", "f", "G"]
#http://pythonhosted.org/ete2/reference/reference_svgcolors.html
mycol = ["crimson", "SeaGreen","green", "cyan", "blue", "gray", "pink"]
pie(pievar, labels = mylab, colors = mycol)



No comments:

Post a Comment