Juni 21, 2013

TUGAS PROBSTAT

TUGAS PROBABILITAS DAN STATISTIKA
Ploting Data Menggunakan Python 2.7
Oleh:
Idriansyah
NPM: 1215031038
Probstat Kelas B
 



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

 #IDRIANSYAH
#1215031038

"""
Perbandingan Jumlah Perusahaan Sapi Perah Menurut Kegiatan Utama (data : 2000-2011)
data from http://bps.go.id/tab_sub/view.php?kat=3&tabel=1&daftar=1&id_subyek=24&notab=1
"""

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

somedates, Pembibitan, Budidaya, PGS, JUMLAH = np.loadtxt('dataidris.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, Pembibitan, 'o-', label='pembibitan')
plt.plot(xdates, Budidaya, 'o-', label='Budidaya')
plt.plot(xdates, PGS, 'o-', label='Pengumpul Susu Sapi')
plt.plot(xdates, JUMLAH, 'o-', label='Jumlah Seluruh')

plt.legend(loc=4)
plt.ylabel('jumlah')
plt.xlabel('Tahun')
plt.grid()
plt.show()