Adding limits to the Y-axis for SymPy.jl plots

I was using SymPy.jl to plot the phase flow of some simple dynamical systems. But I ran into an issue when plotting a particular equation with some discontinuities.

\dot{\theta} = \frac{\sin{\theta}}{\mu + \sin{\theta}}

This plot has a few points, depending on the \mu parameter, where the derivative of \theta collapses to infinity. But when the plot experiences discontinuities, the Y-axis gets so big that it hides the features of the plot along the X-axis. I included an example picture just for demonstration.

The code was
plot(sin(x)/(-1+sin(x)), 0, 4)

Hence I was wondering if there is a way to set the limits of the Y-axis to some smaller range? I could not find any examples of this in the SymPy tutorials so figured I would ask. Thanks.

It is the same solution as when using Plots. Maybe explicitly setting ylim values, or trimming your output with a function that uses NaN when the y values are large, or adjusting your domain will work for you

I assume you are using PyPlot.jl, i.e. matplotlib, for plotting. In this case you can use ylim(ymin, ymax) to set the limits of the y-axes to ymin and ymax respectively.

Oh great. Thanks for pointing this out. I did not realize that SymPy was accessing the regular Plots api. I kept thinking that the plots were based on some internal implementation of the plot() function. Thanks so much.

@j_verzani thanks again for your help. I am finally getting up to speed on SymPy, so hopefully I won’t keep pestering you with these types of questions. But thanks again for being so patient with me.