Created
April 16, 2019 09:36
-
-
Save adxrgh/cc2d5db2f24f83870f46988c9494d94b to your computer and use it in GitHub Desktop.
[双y轴] 左右Y轴不同的坐标系 #plot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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