import numpy as np import matplotlib.pyplot as plt # %% Data: t_array = np.arange(2010, 2019+1) kpi_obs_array = np.array( [92.1, 93.3, 93.9, 95.9, 97.9, 100.0, 103.6, 105.5,108.4, 110.8]) # %% Prediction: a = 1.412 b = -2747 kpi_pred_array = a*t_array + b # %% Plotting: plt.close('all') plt.figure(num=1, figsize=(12, 9)) plt.plot(t_array, kpi_obs_array,'bo-', label='kpi_virkelig') plt.plot(t_array, kpi_pred_array,'ro-', label='kpi_predikert') plt.legend() plt.title('Konsumprisindeks (KPI)-virkelig og predikert') plt.xlabel('t [year]') plt.grid() # plt.savefig('prog_plot_kpi_2010_2019_pred_and_real.pdf') plt.show()