Skip to content

Commit 645816a

Browse files
committed
ylims
1 parent ca2df6c commit 645816a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

class01/class01_intro.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ md"State $x$ is everything you need to define to determine the how your system w
481481
md"### Example: Pendulum"
482482

483483
# ╔═╡ baa3993c-96b0-474e-b5b4-f9eaea642a49
484-
function pendulum(θ_deg = 60; L = 4, fsize = (520, 450), _xlims=nothing)
484+
function pendulum(θ_deg = 60; L = 4, fsize = (520, 450), _xlims=nothing, _ylims=(-5, 5))
485485
θ = deg2rad(θ_deg)
486486
pivot = Point2f(0, 0)
487487
mass = Point2f(-L*sin(θ), -L*cos(θ)) # rod tip
@@ -495,11 +495,9 @@ function pendulum(θ_deg = 60; L = 4, fsize = (520, 450), _xlims=nothing)
495495
xgridvisible = false,
496496
ygridvisible = false)
497497
hidespines!(ax)
498-
499-
_y = -L*cos(θ)
500-
if _y > 0
501-
ylims!(ax, (-1, _y + 1))
502-
end
498+
if !isnothing(_ylims)
499+
ylims!(ax, _ylims)
500+
end
503501

504502
if !isnothing(_xlims)
505503
xlims!(ax, _xlims)

0 commit comments

Comments
 (0)