NAMA : GIFINRI PRATAMA SINAGA
NPM : 1215031034
KELAS: B
sumber data dapat dilihat di sini.
NPM : 1215031034
KELAS: B
sumber data dapat dilihat di sini.
Data Produktifitas Tanaman Pangan
tahun padi jagung kedelai
2004 45.36 33.44 12.8
2005 45.74 34.54 13.01
2006 46.2 34.7 12.88
2007 47.05 36.6 12.91
2008 48.94 40.78 13.13
2009 49.99 42.37 13.48
2010 50.15 44.36 13.73
2011 49.8 45.65 13.68
2012 51.36 48.93 15
2004 45.36 33.44 12.8
2005 45.74 34.54 13.01
2006 46.2 34.7 12.88
2007 47.05 36.6 12.91
2008 48.94 40.78 13.13
2009 49.99 42.37 13.48
2010 50.15 44.36 13.73
2011 49.8 45.65 13.68
2012 51.36 48.93 15
Syntax Phyton
#Gifinri Pratama Sinaga
#1215031034
"""
tentang indeks produktivitas tanaman pangan data 2004 - 2012 nasional
data from http://www.bappenas.go.id/proto-bappenas/file-uploads/1.Buku_Datin_Kinerja_Pembangunan_2004-2012B.pdf
"""
import matplotlib.pyplot as plt
import numpy as np
import datetime
somedates, padi, jagung, kedelai = np.loadtxt('pangan.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, padi,'o-',label='Padi')
plt.plot(xdates, jagung,'o-',label='Jagung')
plt.plot(xdates, kedelai, 'o-',label='Kedelai')
plt.legend(loc=4)
plt.ylabel('Produktivitas Tanaman Pangan')
plt.xlabel('Tahun')
plt.grid()
plt.savefig('dates-tutorial01.png')
plt.show()
#1215031034
"""
tentang indeks produktivitas tanaman pangan data 2004 - 2012 nasional
data from http://www.bappenas.go.id/proto-bappenas/file-uploads/1.Buku_Datin_Kinerja_Pembangunan_2004-2012B.pdf
"""
import matplotlib.pyplot as plt
import numpy as np
import datetime
somedates, padi, jagung, kedelai = np.loadtxt('pangan.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, padi,'o-',label='Padi')
plt.plot(xdates, jagung,'o-',label='Jagung')
plt.plot(xdates, kedelai, 'o-',label='Kedelai')
plt.legend(loc=4)
plt.ylabel('Produktivitas Tanaman Pangan')
plt.xlabel('Tahun')
plt.grid()
plt.savefig('dates-tutorial01.png')
plt.show()
Grafik Produktifitas Tanaman Pangan
Tidak ada komentar:
Posting Komentar