From 51fcfd372ad3caa2e618ea19faa3388194d42c7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlio=20Hoffimann?= Date: Wed, 30 Oct 2024 10:20:55 -0300 Subject: [PATCH] Add plot for EmpiricalTransioplane --- ext/transioplot.jl | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/ext/transioplot.jl b/ext/transioplot.jl index 610f42d..97aa389 100644 --- a/ext/transioplot.jl +++ b/ext/transioplot.jl @@ -62,6 +62,50 @@ function transioplot( fig end +function transioplot( + t::EmpiricalTransioplane; + # common transiogram options + levels=nothing, + # empirical transioplane options + colormap=:viridis +) + # polar angle + θs = t.θs + + # polar radius + rs = t.rs + + # transioplane values + hs = t.hs + + # number of labels + L = size(first(hs), 1) + + # retrieve labels + l = isnothing(levels) ? (1:L) : levels + + fig = Makie.Figure() + for i in 1:L, j in 1:L + lᵢ, lⱼ = l[i], l[j] + ax = Makie.PolarAxis(fig[i, j], title="$lᵢ → $lⱼ") + + # values in matrix form + h = getindex.(hs, i, j) + H = reduce(hcat, h) + + # hide hole at center + rs = [zero(eltype(rs)); rs] + H = [H[1:1, :]; H] + + # transpose for plotting + H = transpose(H) + + Makie.surface!(ax, θs, rs, H, colormap=colormap, shading=Makie.NoShading) + end + + fig +end + # ------------ # THEORETICAL # ------------