# daily line plots
from pandas import read_csv
import matplotlib.pyplot as plt

# load the new file
dataset = read_csv('HondaHome2018_NET_POWER_Hourly.csv', 
#dataset = read_csv('HondaHome2018_Cleaned.csv',
                   header=0, 
                   low_memory=False, 
                   infer_datetime_format=True, 
                   parse_dates=['datetime'], 
                   index_col=['datetime'])
#How to change the font size on a matplotlib plot
#https://stackoverflow.com/questions/3899980/how-to-change-the-font-size-on-a-matplotlib-plot
plt.rc('font', size=14)
plt.rc('axes', titlesize=14)


# plot active power for each day of first 20 days in a month
days = [x for x in range(1, 3)]
plt.figure()

for i in range(len(days)):
    # determine the day to plot
    day = '2018-02-' + str(days[i]) # Feb 
    # get all observations for the day
    result = dataset.loc[day]
    
    plt.subplot(len(days), 1, i+1) 
    plt.plot(list(range(0, 24)), result['Net_Total'], marker='', color='green', 
             linewidth=2, label='Net Total')
    plt.plot(list(range(0, 24)), result['Lighting'], marker='', color='brown', 
             linewidth=2, linestyle='dashed', label="Lighting")
    plt.xlabel('Time [h]')
    plt.ylabel('Power [kW]')
    plt.legend(loc="upper left")
    
    # add a title to the subplot
    plt.title(day, y=0, loc='left')
    
plt.show()
