Friday, June 14, 2013

Probabilitas Dan Statistika


Plotting Data Menggunakan Phyton



Oleh :
Faizun Iqbal Zulfi

1215031030


Data yang digunakan :


sumber : http://www.bps.go.id/tab_sub/view.php?kat=3&tabel=1&daftar=1&id_subyek=56&notab=1


Syntax :


import numpy as np
import matplotlib.pyplot as plt

N = 11
pmaMeans = (16,16,7,8,10,6,4,7,7,10,12)

ind = np.arange(N)  # the x locations for the groups
width = 0.3       # the width of the bars

plt.subplot(111)
rects1 = plt.bar(ind, pmaMeans, width,
                    color='r',
                    error_kw=dict(elinewidth=5, ecolor='pink'))

pmdnMeans = (52,52,14,17,22,10,3,4,11,17,17)

rects2 = plt.bar(ind+width, pmdnMeans, width,
                    color='y',
                    
                    error_kw=dict(elinewidth=5, ecolor='yellow'))

lainnyaMeans = (143,142,30,34,51,31,27,33,43,49,58)

rects3 = plt.bar(ind+width+width, lainnyaMeans, width,
                    color='b',
                    
                    error_kw=dict(elinewidth=5, ecolor='blue'))

# add some
plt.ylabel('jumlah')
plt.title('Jumlah Perusahaan Penangkapan Ikan Menurut Status Permodalan, 2000-2010')
plt.xticks(ind+width, ('2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010') )

plt.legend( (rects1[0], rects2[0], rects3[0]), ('PMA','PMDN','lainnya') )

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.grid()
plt.show()


Grafik yang ditampilkan :

Grafik diatas menunjukkan jumlah perusahaan penangkapan ikan menurut status permodalan 2000-2010


No comments:

Post a Comment