Sympy plotting has recently evolved a lot, but I cannot find a way to plot a second expression on a secondary y-axis. Below, I show an example where I combine two plots, but would like the second to use a secondary axis:
>>> from sympy import symbols
>>> from sympy.plotting import plot
>>> x = symbols('x')
>>> p1 = plot(x**4, (x,10,20), label='$x^4$', show=False, legend=True)
>>> p2 = plot(x, (x,10,20), line_color='red', label='$x$', show=False, legend= True)
>>> p1.extend(p2)
>>> p1.show()
Incidentally, is there a way to also modify the line style, e.g. make one of them dashed? The documentation suggests to use the _backend
module for fine tuning, but it is not clear to me how to achieve this. See e.g. How do I use the `_backend` attribute of a Sympy `plot`.