Jumat, 14 Juni 2013

Tugas Probabilitas Statistika

Tugas Probabilitas Statistika

Nama : Didi Ardiansyah
NPM : 1215031021
Kelas A

Sintax Program

import numpy as np
import matplotlib.pyplot as plt

N = 5
TenagaAirMeans = (3501.5, 3504.4, 3508.6, 3682.6, 3844.7)

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

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

TenagaUapMeans = (7114.0, 8764.0, 8764.0, 13045.5, 15775.5)

rects2 = plt.bar(ind+width, TenagaUapMeans, width,
                    color='r',
                    error_kw=dict(elinewidth=5, ecolor='red'))

TenagaGasMeans = (1885.6, 2496.7, 2570.6, 3634.7, 3250.4)

rects3 = plt.bar(ind+(width*2), TenagaGasMeans, width,
                    color='magenta',
                    error_kw=dict(elinewidth=5, ecolor='magenta'))

TenagaGasUapMeans = (6280.9, 7371.0, 7371.0, 8029.3, 8619.0)

rects4 = plt.bar(ind+(width*3), TenagaGasUapMeans, width,
                    color='cyan',
                    error_kw=dict(elinewidth=5, ecolor='cyan'))

TenagaPanasBumiMeans = (415.0, 830.0, 415.0, 1130.0, 1131.3)

rects5 = plt.bar(ind+(width*4), TenagaPanasBumiMeans, width,
                    color='g',
                    error_kw=dict(elinewidth=5, ecolor='green'))

TenagaDieselMeans = (2956.2, 3020.8, 2980.8, 3327.8, 2633.0)

rects6 = plt.bar(ind+(width*5), TenagaDieselMeans, width,
                    color='orange',
                    error_kw=dict(elinewidth=5, ecolor='orange'))
# add some
plt.ylabel('nilai')
plt.title('Kapasitas Terpasang (MW) Perusahaan Listrik Negara (PLN) menurut Jenis Pembangkit Listrik 2007-2011')
plt.xticks(ind+width, ('2007', '2008', '2009', '2010', '2011') )

plt.legend( (rects1[0], rects2[0], rects3[0], rects4[0], rects5[0], rects6[0]), ('TenagaAir', 'TenagaUap', 'TenagaGas', 'TenagaGasUap', 'TenagaPanasBumi', 'TenagaDiesel') )

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)
autolabel(rects5)
autolabel(rects6)

plt.show()

Tidak ada komentar:

Posting Komentar