You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.
This needs add SimpleSDMLayers#interfaces-iteration to work
@mkborregaard, following your advice in #120, I tried to put the bivariate plot to a recipe. When I do this, it "works" (I get no error message), but the plot is what you get when only calling plot().
Any idea? Can it be because there is a plot(x, y) method for two layers already defined?
using Plots
using RecipesBase
using SimpleSDMLayers
using Colors, ColorBlendModes
layer1, layer2 =SimpleSDMPredictor(WorldClim, BioClim, [1,12]; left=-20.0, right=55.0, top=42.0, bottom=-36.0)
q1 =rescale(layer1, collect(LinRange(0.0, 1.0, 25)))
q2 =rescale(layer2, collect(LinRange(0.0, 1.0, 25)))
@shorthands bivariate
@recipefunctionf(::Type{Val{:bivariate}}, plt::AbstractPlot; classes=3, p0=colorant"#e8e8e8", p1=colorant"#64acbe", p2=colorant"#c85a5a")
# Get the palettes
c1 =palette([p0, p1], classes)
c2 =palette([p0, p2], classes)
breakpoints =LinRange(0.0, 1.0, classes+1)
xlims -->extrema(longitudes(x))
ylims-->extrema(latitudes(x))
legend -->false
aspectratio -->1
frame -->:box
subplot -->1
seriestype -->:heatmapfor i in2:length(breakpoints)
m1 =broadcast(v -> breakpoints[i -1] <= v <= breakpoints[i], x)
for j in2:length(breakpoints)
m2 =broadcast(v -> breakpoints[j -1] <= v <= breakpoints[j], y)
m =reduce(*, [m1, m2])
replace!(m, false=>nothing)
replace!(m, nothing=>NaN)
@seriesbegin
color -->BlendMultiply(c1[i -1], c2[j -1])
longitudes(m), latitudes(m), convert(Matrix{Float64}, m.grid)
endendendendbivariate(q1, q2)
The text was updated successfully, but these errors were encountered:
This needs
add SimpleSDMLayers#interfaces-iteration
to work@mkborregaard, following your advice in #120, I tried to put the bivariate plot to a recipe. When I do this, it "works" (I get no error message), but the plot is what you get when only calling
plot()
.Any idea? Can it be because there is a
plot(x, y)
method for two layers already defined?The text was updated successfully, but these errors were encountered: