Skip to content

Commit

Permalink
makie recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
gottacatchenall committed Dec 21, 2024
1 parent 10fe3a8 commit d425fd1
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions ext/BONsMakieExt/recipes.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const MAX_CORNERPLOT_DIMS_BEFORE_PCA = 20

function BiodiversityObservationNetworks.cornerplot(
layers::RasterStack;
pca_layers = false
)

_, mat = BiodiversityObservationNetworks.features(layers)
num_layers = length(layers)
if num_layers > MAX_CORNERPLOT_DIMS_BEFORE_PCA || pca_layers
pca = BiodiversityObservationNetworks.MultivariateStats.fit(BiodiversityObservationNetworks.MultivariateStats.PCA, mat)
@info length(pca.prinvars)
num_layers = length(pca.prinvars)
mat = BiodiversityObservationNetworks.MultivariateStats.transform(pca, mat)
end

f = Figure(size=(900,900))
for i in 1:num_layers-1, j in 1:num_layers
if j > i
ax = Axis(
f[j-1,i],
xlabel = j == num_layers ? "$i" : "",
ylabel = i == 1 ? "$j" : "",
xticksvisible=false,
yticksvisible=false,
xticklabelsvisible=false,
yticklabelsvisible=false,
)
hexbin!(ax, mat[i,:], mat[j,:], bins=40)
end
end
f
end

0 comments on commit d425fd1

Please sign in to comment.