import matplotlib.pyplot as plt import numpy as np # %% Data: M = np.loadtxt('klima.txt', delimiter=' ') year = M[:, 0] temp = M[:, 1] # %% Beregning og plott av middelverdi temp_mid = np.mean(temp[61:90]) mid = temp_mid*np.ones(len(temp)) print('Middeltemperatur =', f'{temp_mid:.2f}') plt.close('all') plt.plot(year, temp, 'r*', year, mid) plt.ylabel('Temp [deg C]') plt.show() plt.savefig('plot_klima3.pdf')