Skip to content

Instantly share code, notes, and snippets.

@adxrgh
Created April 16, 2019 09:36
Show Gist options
  • Save adxrgh/cc2d5db2f24f83870f46988c9494d94b to your computer and use it in GitHub Desktop.
Save adxrgh/cc2d5db2f24f83870f46988c9494d94b to your computer and use it in GitHub Desktop.
[双y轴] 左右Y轴不同的坐标系 #plot
import matplotlib.pyplot as plt
from datetime import datetime as dt
import os
now =dt.now().strftime('%Y%m%d_%H_%M_%S')
fig = plt.figure()
ax =fig.add_subplot(111)
s.iloc[:,0].plot(ax=ax)
s.iloc[:,1].plot(secondary_y=True)
ax.set_ylabel('市值')
ax.right_ax.set_ylabel('价格')
plt.legend(loc='best')
fig.savefig(now+'.png')
os.system('start '+now+'.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment