Jumat, 14 Juni 2013

Indikator Sosial Budaya

TUGAS PROBABILITAS DAN STATISTIKA

Oleh :
Mahendra Dwi Gusniawan
1215031048

Teknik Elektro B

Grafik :

Source Code on Python :

"""
http://bps.go.id/tab_sub/view.php?kat=1&tabel=1&daftar=1&id_subyek=27&notab=36
"""

import numpy as np
import matplotlib.pyplot as plt

N = 4
radioMeans = (50.29, 40.26, 23.50, 18.57)

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

plt.subplot(111)
rects1 = plt.bar(ind, radioMeans, width,
                    color='b',
                    error_kw=dict(elinewidth=5, ecolor='blue'))

televisiMeans = (84.94, 85.86, 90.27, 91.68)

rects3 = plt.bar(ind+width, televisiMeans, width,
                    color='#98FB98',
                  
                    error_kw=dict(elinewidth=5, ecolor='Palgreen'))

suratkabarMeans = (23.70, 23.46, 18.94, 17.66)
rects2 = plt.bar(ind+width+width, suratkabarMeans, width,
                    color='r',
            
                    error_kw=dict(elinewidth=5, ecolor='red'))

olahragaMeans = (25.45, 23.23, 21.76, 24.99)

rects4 = plt.bar(ind+width+width+width, olahragaMeans, width,
                    color='#FFF443',
            
                    error_kw=dict(elinewidth=5, ecolor='black'))


# add some
plt.ylabel('Persen (%)')
plt.xlabel('Tahun')
plt.title('Indikator Sosial Budaya Tahun 2003, 2006, 2009, 2012')
plt.xticks(ind+width, ('2003', '2006', '2009', '2012') )

plt.legend( (rects1[0], rects2[0], rects3[0], rects4[0]), ('Radio', 'Surat Kabar', 'Televisi', 'Olahraga') , loc=1)

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)
autolabel(rects4)

plt.show()
 
 

Data Source :
http://bps.go.id/tab_sub/view.php?kat=1&tabel=1&daftar=1&id_subyek=27&notab=36

Tidak ada komentar:

Posting Komentar