I am trying to designate both the Y axis and the "WLL", and the other the "S & P 500". Right now I can only designate the secondary Y axis (S & P 500).
import pandas as pd
from pandas import DataFrame
from matplotlib import pyplot as plt
import pandas.io.data as web
import datetime as dt
start = '2013-01-01'
end = dt.datetime.today()
df = web.DataReader('WLL', 'yahoo', start, end)
sp = web.DataReader('^GSPC', 'yahoo', start, end)
fig, ax1 = plt.subplots()
df['Close'].plot(ax=ax1,color='g',linewidth=1.0)
sp['Close'].plot(secondary_y=True, ax=ax1,color='b',linewidth=1.0)
ax = df['Close'].plot(); sp['Close'].plot(ax=ax, secondary_y=True)
plt.xlabel('xlabel', fontsize=10)
plt.ylabel('ylabel', fontsize=10)
plt.show()
source
share