# -*- coding: utf-8 -*- """ Created on Tue Jun 4 21:31:55 2019 @author: finnh """ import numpy as np import matplotlib.pyplot as plt month = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) # mnd nr temp = np.array([-3, -2, 2, 7, 11, 15, 17, 16, 12, 6, 2, -3]) # grad C mean_temp = np.mean(temp) # Middelverdi mean_temp_array = np.zeros(len(temp)) + mean_temp #mean_temp_array = temp*0 + mean_temp plt.figure(1) plt.plot(month, temp, 'o-b', month, mean_temp_array, 'g') plt.title('Monthly mean temp in Skien 2005-2015') plt.xlabel('Month no. [nr.]') plt.ylabel('[Deg C]') plt.legend(labels=('Temperature', 'Mean temp'), loc='upper right', handlelength=2, fontsize=8) plt.grid() plt.show() plt.savefig('temp_skien_legend.pdf')