def plot_mod_fit(df, col): import matplotlib.pyplot as plt fig = plt.figure(figsize=(8, 5)) # set plot area ax = fig.gca() # define axis df.loc[:, col].plot(color = 'r', ax = ax) df.loc[:, 'scores'].plot(ax = ax) ax.set_title('Actual ' + col + 'vs. the predicted values') # give the plot a main title ax.set_xlabel('Date') # set text for the x axis ax.set_ylabel(col)# set text for y axis plot_mod_fit(CBE, 'elec_log')