Tugas Probabilitas dan Statistika dengan menggunakan Phyton 3.3.2
Disususn Oleh :
Aji Irawan
1215031007
Kelas A
Grafik
Syntax
import numpy as np
import matplotlib.pyplot as plt
N = 3
maretMeans = [-0.32, 0.07, 0.63 ]
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, maretMeans, width,
color='r',
error_kw=dict(elinewidth=5, ecolor='pink'))
janmarMeans = [0.70, 0.88, 2.43]
rects2 = plt.bar(ind+width, janmarMeans, width,
color='g',
error_kw=dict(elinewidth=5, ecolor='yellow'))
martmartMeans = [6.65, 3.97, 5.90]
rects3 = plt.bar(ind+width+width, martmartMeans, width,
color='b',
error_kw=dict(elinewidth=5, ecolor='yellow'))
# add some
plt.ylabel('Presentase')
plt.title('Inflasi Bulanan, Tahun kalender, Year on Year
Tahun 2011–2013')
plt.xticks(ind+width, ('2011', '2012','2013') )
plt.legend( (rects1[0], rects2[0], rects3[0]), ('maret ',
'janmar', 'martmart',) )
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://bps.go.id/brs_file/inflasi_01apr13.pdf