Jumat, 14 Juni 2013

NILAI EXPOR NONMIGAS

Friday, June 14, 2013

Tugas Kuliah Probabilitas dan Statistika : Plotting Data Menggunakan Pemrograman Python



Plotting Data Menggunakan Pemrograman Python


Nama  : KHAIRUL ANWAR
NPM   : 1215031040
Kelas : B


Software yang digunakan :
- Python 3.3.1

- Numpy 1.7.1 untuk Python 3.3
- Matplotlib 1.2.1 untuk Python 3.3


Data yang digunakan :


tahun    tmb    ind     tani    eks
2004    4.8     47.7     2.5     55.9
2005    7.8     55.6     2.9     66.4
2006    11.2    56.0     3.4     79.6
2007    11.9    76.5     3.7     92.0
2008    14.9    88.4     4.6     107.9
2009    19.7    73.4     4.4     92.5
2010    26.7    98.0     5.0     129.7
2011    34.7    112.2    5.2     162.0
2012    31.3    116.1    5.6     153.1


 http://www.bappenas.go.id/proto-bappenas/file-uploads/1.Buku_Datin_Kinerja_Pembangunan_2004-2012B.pdf"""

SINTAX pemrograman :


import matplotlib.pyplot as plt
import numpy as np
import datetime

somedates, tmb, ind, tani, eks = np.loadtxt('ekspor.txt',skiprows=1,unpack=True)

xdates = [datetime.datetime.strptime(str(int(date)),'%Y') for date in somedates]

fig = plt.figure()
ax = plt.subplot(111)
plt.plot(xdates, tmb,'o-',label='Pertambangan')
plt.plot(xdates, ind,'o-',label='Industri')
plt.plot(xdates, tani, 'o-',label='Pertanian')
plt.plot(xdates, eks, 'o-',label='Ekspor Nonmigas')
plt.legend(loc=4)
plt.ylabel('Indeks Nilai Ekspor Nonmigas')
plt.xlabel('Tahun')
plt.grid()
plt.savefig('dates-tutorial01.png')
plt.show()
 


Gambar yang dihasilkan: