From d4ea2cd33ccdb77bd740dbfafbd81d08c1ac9074 Mon Sep 17 00:00:00 2001 From: Pedro Maciel Xavier Date: Fri, 27 Sep 2024 13:01:04 -0400 Subject: [PATCH] Enhance graphics --- .../analysis/visualization/model_density.jl | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/library/analysis/visualization/model_density.jl b/src/library/analysis/visualization/model_density.jl index 12826aa..0a12264 100644 --- a/src/library/analysis/visualization/model_density.jl +++ b/src/library/analysis/visualization/model_density.jl @@ -10,17 +10,34 @@ function ModelDensityPlot(model::Any) return ModelDensityPlot(backend(model)) end +function _model_density_ticks( + n::Integer, + p::Integer = (n <= 16) ? n : 8, +) + if n <= p + return collect(Int, 1:n) + else + k = round(Int, n / p) + + return [1;(k+1):k:(n-k);n] + end +end + @recipe function plot(plt::ModelDensityPlot{V,T,U,M}) where {V,T,U,M} title --> "Model Density" color --> :balance xlabel --> "Variable Index" ylabel --> "Variable Index" - margin --> (0.5, :cm) fontfamily --> "Computer Modern" + top_margin --> ( 0, :px) + bottom_margin --> ( 0, :px) + left_margin --> (20, :px) + right_margin --> (20, :px) + n, L, Q, α = form(plt.model, :dense) - t = collect(1:(n÷10+1):n) + t = _model_density_ticks(n) z = α * (Symmetric(Q / 2) + diagm(L)) Γ = maximum(abs.(z)) @@ -32,6 +49,8 @@ end xmirror := true seriestype := :heatmap aspect_ratio := :equal + framestyle := :grid + size := (505, 500) return (1:n, 1:n, collect(z)) end