arunreddy
7/23/2017 - 10:16 PM

RTD_ZONAL_LBMP.py

RTD_ZONAL_LBMP.py

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from matplotlib.dates import DateFormatter, MinuteLocator, MonthLocator


def datetime(x):
  return np.array(x, dtype = np.datetime64)


if __name__ == '__main__':
  
  # Save the file as a .csv file from your excel.
  file_name = 'RTC_RTD_LBMP_NYCA.csv'
  
  # Read the file into the code.
  df = pd.read_csv(file_name, parse_dates = ['BINDING_TIMESTAMP'])
  
  plt.figure(figsize=(30,5))
  
  
  # Plot 01
  plt.plot(datetime(df['BINDING_TIMESTAMP']),df['RTD_ZONAL_LBMP'], label = 'RTD_LBMP', c = 'red')
  
  # Plot 02
  plt.plot(datetime(df['BINDING_TIMESTAMP']),df['RTC_zonal_LBMP'], label = 'RTC_LBMP', c = 'blue')

  plt.title("NYCA Zone")
  plt.xlabel('Binding Timestamp')
  plt.legend()
  plt.grid()
  
  #
  start = df['BINDING_TIMESTAMP'].min()
  end = df['BINDING_TIMESTAMP'].max()
  plt.xlim(start,end)

  date_formatter = '%b %y'
  xfmt = DateFormatter(date_formatter)
  ax = plt.gca()
  ax.xaxis.set_major_locator(MonthLocator())
  ax.xaxis.set_major_formatter(xfmt)
  
  
  plt.show()