import pylab as pl,numpy as np
columns=['Fresh','Milk','Grocery','Frozen',
'Detergents_Paper','Delicatessen']
rows=['Customer 1','Customer 2','Customer 3']
colors=['#3636ff','#36ff36','#ff3636']
data=[[26373,36423,22019,5154,4337,16523],
[16165,4230,7595,201,4003,57],
[14276,803,3045,485,100,518]]
pl.ylabel('value'); pl.xticks([])
x=np.arange(len(columns))+.2
y=np.array([0.]*len(columns))
bar_width=.5; cell_text=[]
for i in range(len(rows)):
pl.bar(x,data[i],bar_width,bottom=y,color=colors[i])
cell_text.append(['%1.0f'%(d)for d in data[i]])
pl.table(cellText=cell_text,
rowLabels=rows,rowColours=colors,
colLabels=columns,loc='bottom')
pl.title('Samples of the Wholesale Customers Dataset')
pl.subplots_adjust(left=.1,bottom=.05);
No comments:
Post a Comment