import numpy as np import matplotlib.pyplot as plt mnd = 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]) # [C] fig = plt.figure() # Lager et figure-objekt med navn fig. ax = fig.subplots() # Lager et axes-objekt med navn ax. ax.plot(mnd, temp) # Bruker plot-metoden til objektet ax. ax.set_xlabel('Maaned nr.') ax.set_ylabel('Grader C') ax.grid() plt.savefig('oppg_temp_skien_oo_plotting.pdf') plt.show() # Bruker show-funksjonen i Pyplot-modulen til aa vise plottet.