Skip to content

Commit e0e211d

Browse files
committed
imrpove plot display
1 parent a280fac commit e0e211d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

docs/src/steady_state_functionality/examples/nullcline_plotting.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@ function get_XY(Xval, Yval)
3737
prob = Catalyst.remake(nlprob; u0 = [:X => Xval, :Y => Yval])
3838
return nlprob.f(prob.u0, prob.p)
3939
end
40+
nothing # hide
4041
```
4142
Next, we plot our nullclines by using Plot.jl's [`contour` function](https://docs.juliaplots.org/latest/series_types/contour/). Here, we plot the $0$ contour lines (which corresponds to the nullclines) for both the $X$ and $Y$ nullclines. We will plot the steady states using `scatter`. We use the `steady_state_stability` function to [compute steady state stabilities](@ref steady_state_stability) (and use this to determine how to plot the steady state markers).
4243
```@example nullcline_plotting
4344
using Plots
4445
# Plot the nullclines. Line labels added in separate `plot` commands (due to how the `contour` works).
4546
plt_mesh = 0:0.02:1.25
46-
contour(plt_mesh, plt_mesh, (x,y) -> get_XY(x,y)[1]; levels = [0.0], lw = 7, la = 0.7, color = 1, cbar=false)
47-
contour!(plt_mesh, plt_mesh, (x,y) -> get_XY(x,y)[2]; levels = [0.0], lw = 7, la = 0.7, color = 2, cbar=false)
47+
contour(plt_mesh, plt_mesh, (x,y) -> get_XY(x,y)[1]; levels = [0.0], lw = 7, la = 0.7, color = 1, cbar = false)
48+
contour!(plt_mesh, plt_mesh, (x,y) -> get_XY(x,y)[2]; levels = [0.0], lw = 7, la = 0.7, color = 2, cbar = false)
4849
plot!([]; label = "dX/dt = 0", lw = 7, la = 0.7, color = 1)
4950
plot!([]; label = "dY/dt = 0", lw = 7, la = 0.7, color = 2)
5051
@@ -61,7 +62,7 @@ scatter!([], []; color = :blue, markershape = :circle, label = "Stable stead sta
6162
scatter!([], []; color = :red, markershape = :star4, label = "Unstable stead state")
6263
6364
# Finishing touches.
64-
plot!(xguide = "X", yguide = "Y", legendfontsize = 10, size = (600,600))
65+
plot!(xguide = "X", yguide = "Y", xlimit = (0.0, 1.25), ylimit = (0.0, 1.25), legendfontsize = 10, size = (600,600), legend = :topright)
6566
```
6667
Here we can see how the steady states occur at the nullclines intersections.
6768

0 commit comments

Comments
 (0)