#加载相应的包
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
#从Excel导入数据
data = pd.read_excel('F:/data.xls')
#建立画布
fig = plt.figure()
#坐标轴1
ax1 = fig.add_subplot(111)
ax1.plot(data.Time,data.ETF,linewidth=2)
#坐标轴1标签
ax1.set_ylabel('ETF')
#图例位置
plt.legend(loc='upper left')
#添加文本
plt.text('2013',4.5,'correlation:99.47%',fontsize=15)
#坐标轴2
ax2 = ax1.twinx()
ax2.plot(data.Time,data.IF,'r',linewidth=2)
ax2.set_ylabel('IF')
plt.legend(loc='upper right')
plt.title('ETF & IF (2013~2017)')
plt.show()