Grafik Statistika Dengan Menggunakan Python 3.3.2
Oleh
Agung Heru Saputra
1215031005
kelas A
Grafik
Syntax
import numpy as np
import matplotlib.pyplot as plt
N = 2
kotaMeans = (9.23,8.78 )
ind = np.arange(N) #
the x locations for the groups
width = 0.2 #
the width of the bars
plt.subplot(111)
rects1 = plt.bar(ind, kotaMeans, width,
color='r',
error_kw=dict(elinewidth=5, ecolor='pink'))
desaMeans = (15.72,15.12)
rects2 = plt.bar(ind+width, desaMeans, width,
color='g',
error_kw=dict(elinewidth=5, ecolor='yellow'))
kotadesaMeans = (12.49,11.96)
rects3 = plt.bar(ind+width+width, kotadesaMeans, width,
color='b',
error_kw=dict(elinewidth=5, ecolor='yellow'))
# add some
plt.ylabel('Presentase')
plt.title('Presentase Penduduk Miskin Maret 2011 - Maret
2012')
plt.xticks(ind+width, ('2011', '2012') )
plt.legend( (rects1[0], rects2[0], rects3[0]), ('kota ',
'desa', 'kotadesa',) )
def autolabel(rects):
# attach some text
labels
for rect in rects:
height =
rect.get_height()
plt.text(rect.get_x()+rect.get_width()/4., 1.01*height,
'%d'%int(height),
ha='left', va='bottom')
autolabel(rects1)
autolabel(rects2)
autolabel(rects3)
plt.show()
Sumber Data:
http://data.tnp2k.go.id/?q=content/perkembangan-tingkat-kemiskinan-maret-2011%E2%80%93maret-2012