import matplotlib.pyplot as plt import numpy as np M = np.loadtxt('dyrebestand.txt', delimiter=' ') mnd = M[:, 0] antall = M[:, 1] print('Antall observerte villrein jan 2007 var', antall[12*2]) print('Antall observerte villrein jan 2011 var', antall[12*6]) min_ant = np.argmin(antall) min_mnd = mnd[min_ant] aar, maaned = divmod(min_mnd, 12) print("Bestanden var paa sitt minste i", int(2005+aar), "i mnd", int(maaned)) tot_mnd = 0 for i in range(0, len(mnd), 1): if (antall[i] > 1000): tot_mnd = tot_mnd + 1 print('Bestanden var over 1000 dyr i', tot_mnd,'mnd') plt.close('all') plt.plot(mnd,antall) plt.xlabel('mnd') plt.ylabel('antall') plt.grid() # plt.savefig('plott_dyrebestand.pdf') plt.show()