Friday, 7 May 2010

Matplotlib bar charts.

from pylab import *
import numpy.numarray as na

labels = ['Other', 'Lib Dem', 'Warmongers', 'Posh twats']
data = [12, 23, 29, 36] # % data from the independent.
xlocations = na.array(range(len(data)))+0.5

width = 0.5
bar(xlocations, data, width=width)
ylim(0, 100) # a meaningful scale.
title("Voting proportions on a meaningful (%) scale")
gca().get_xaxis().tick_bottom()
gca().get_yaxis().tick_left()
xticks(xlocations+ width/2, labels)

No comments:

Post a Comment