From 9846aefad4584c70e2a7bb73c0bdf71f4400730e Mon Sep 17 00:00:00 2001 From: Jakub Nowosad Date: Wed, 18 Dec 2024 13:20:52 +0100 Subject: [PATCH] adds both tmap3 and tmap4 code --- vignettes/cast01-CAST-intro.Rmd | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/vignettes/cast01-CAST-intro.Rmd b/vignettes/cast01-CAST-intro.Rmd index efbce0c..f1a0997 100644 --- a/vignettes/cast01-CAST-intro.Rmd +++ b/vignettes/cast01-CAST-intro.Rmd @@ -253,14 +253,24 @@ Still it is required to analyse if the model can be applied to the entire study ```{r, message = FALSE, warning=FALSE} ### AOA for which the spatial CV error applies: AOA <- aoa(predictors_sp,ffsmodel,LPD = TRUE,verbose=FALSE) -tm_shape(prediction) + - tm_raster(col.scale = tm_scale_continuous(values = "-viridis"), - col.legend = tm_legend(title = "Species \nrichness")) + - tm_shape(AOA$AOA) + - tm_raster(col.scale = tm_scale_categorical(values = c("grey", "#00000000")), - col.legend = tm_legend(show = FALSE)) + - tm_layout(frame = FALSE) + - tm_add_legend(type="polygons", fill = "grey", labels = "Outside \nAOA") + +# tmap3 +tm_shape(prediction)+ + tm_raster(title="Species \nrichness",style="cont")+ + tm_shape(AOA$AOA)+ + tm_raster(palette=c("1"=NA,"0"="grey"),style="cat",legend.show = FALSE)+ + tm_layout(frame=FALSE,legend.outside = TRUE)+ + tm_add_legend(type="fill",col="grey",border.lwd=0, labels="Outside \nAOA") + +# tmap4 +# tm_shape(prediction) + +# tm_raster(col.scale = tm_scale_continuous(values = "-viridis"), +# col.legend = tm_legend(title = "Species \nrichness")) + +# tm_shape(AOA$AOA) + +# tm_raster(col.scale = tm_scale_categorical(values = c("grey", "#00000000")), +# col.legend = tm_legend(show = FALSE)) + +# tm_layout(frame = FALSE) + +# tm_add_legend(type="polygons", fill = "grey", labels = "Outside \nAOA") ``` The figure shows in grey areas that are outside the area of applicability, hence predictions should not be considered for these locations. See tutorial on the AOA in this package for more information.