# -*- coding: utf-8 -*-
"""
Created on March 26, 2021; modified June 7, 2023

@author: CTING
"""

import pandas as pd
import matplotlib.pyplot as plt

ticker = 'TSLA'

df  = pd.read_csv(ticker + '.csv')
df = df.rename(columns={'Unnamed: 0':'Date'})
dateX = pd.to_datetime(df.Date, format='%Y-%m-%d')
dateX.index = range(len(dateX))
df.index = dateX

font = {'family':'sans-serif', 'weight':'normal', 'size':16}
plt.rc('font', **font)

fig = plt.figure(figsize=(12,8))
ax = fig.add_subplot(111)
ax.plot(df.adjclose, c= '#006400',  lw=1.0, label='Adjusted')

ax.autoscale(enable=True, axis='x', tight=True)
plt.ylabel('Futures Price ($)')
plt.xlabel('')
ax.grid(c='#008000', lw=0.5, ls=':' , which='major')

ax.fill_between(dateX, df.adjclose, 0, alpha=0.1, color='g')
ax.set_ylim([0, 415])
ax.legend(shadow=True, fontsize='large')

plt.savefig('plot_data_' + ticker + '.png'  ,dpi=300)













