'Trying to plot two lines on mathplotlib
I am tyring two plot who lines but cannot get the graph to scale properly
#plot2
fig=plt.figure()
ax1=fig.add_subplot(111)
ax1.plot(totalReturnComp["Date"], totalReturnComp["S&P compounded growth"], linewidth=2, color='b')
ax2=ax1.twiny()
ax2.plot(sp_trr["month"], sp_trr["1 MEqual Weight"], linewidth=2, color='g')
ax2.legend(['3 Month Incremental Weight'],frameon=False)
ax1.legend(['S&P Index compounded growth'],frameon=False)
plt.title('3 Month Incremental Weight vs S&P Index')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
