Skip to content

Commit

Permalink
Improve transioplot
Browse files Browse the repository at this point in the history
  • Loading branch information
juliohm committed Oct 8, 2024
1 parent 8feabb0 commit 4e8eef9
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions ext/transioplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,30 @@ function transioplot(
end

# transiogram up to maximum lag
x = range(zero(H), stop=H, length=100)
y = t.(x)
hs = range(zero(H), stop=H, length=100)
ts = t.(hs)

# approximate transiogram at h → ∞
t∞ = t(100H)

fig = Makie.Figure()
for i in 1:L, j in 1:L
lᵢ, lⱼ = l[i], l[j]
ax = Makie.Axis(fig[i, j])
ys = getindex.(y, i, j)
Makie.lines!(ax, x, ys, color=color, linewidth=size, label="$lᵢ$lⱼ")
ys = getindex.(ts, i, j)
Makie.lines!(ax, hs, ys, color=color, linewidth=size, label="$lᵢ$lⱼ")
if i == j
# show effective range
# show mean length
Makie.lines!(ax, [zero(H), r[i]], [1.0, 0.0], color=color, linewidth=size, linestyle=:dash)
# show proportion
Makie.hlines!(ax, t∞[i, j], color=color, linewidth=size, linestyle=:dash)
else
# show random transition model
pᵢ = t∞[i, i]
pⱼ = t∞[j, j]
tᵢᵢ = getindex.(ts, i, i)
rs = @. (1 - tᵢᵢ) * pⱼ / (1 - pᵢ)
Makie.lines!(ax, hs, rs, color=color, linewidth=size, linestyle=:dot)
end
Makie.axislegend(position=i == j ? :rt : :rb)
end
Expand Down

0 comments on commit 4e8eef9

Please sign in to comment.