update on machine learning
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import numpy as np
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
# Load in data file
|
||||
data = np.loadtxt('src/Hudson_Bay.csv', delimiter=',', skiprows=1)
|
||||
# Make arrays containing x-axis and hares and lynx populations
|
||||
year = data[:,0]
|
||||
hares = data[:,1]
|
||||
lynx = data[:,2]
|
||||
|
||||
plt.plot(year, hares ,'b-+', year, lynx, 'r-o')
|
||||
plt.axis([1900,1920,0, 100.0])
|
||||
plt.xlabel(r'Year')
|
||||
plt.ylabel(r'Numbers of hares and lynx ')
|
||||
plt.legend(('Hares','Lynx'), loc='upper right')
|
||||
plt.title(r'Population of hares and lynx from 1900-1920 (x1000)}')
|
||||
plt.savefig('Hudson_Bay_data.pdf')
|
||||
plt.savefig('Hudson_Bay_data.png')
|
||||
plt.show()
|
||||
Reference in New Issue
Block a user