You can create a plot with two y-axes in Matplotlib by creating a twinx axes object. Here's an example:
main.py317 chars18 lines
In this example, ax1 is the primary y-axis, and ax2 is the secondary y-axis. ax2 is created by calling ax1.twinx(). You can then plot data on ax2 using the standard plot() function.
Make sure to specify the color argument to set the y-axis labels to different colors, since the default is blue for both.
gistlibby LogSnag