rgbPlot | R Documentation |
Plot a map with leverage values as RGB colours. The leverage values outputted from SDM profilinf for unsampled cells for three leverage categories are mapped on to the RGB values
rgbPlot( profile, origSDM, dual_col = "green", absence_col = "red", save_plots = FALSE )
profile |
the output from |
origSDM |
a raster file of the probability of occurrences of the original
SDM built using the sampled cells (i.e. those in |
dual_col |
The colour (either |
absence_col |
The colour (either |
save_plots |
TRUE or FALSE whether to save the final plots to a TableGrob object |
a tableGrob of two raster plots: 1) a legend plot that includes the profiling values as well as a background of the RGB colours 2) a raster of the RGB colours for the profilied cells
Optionally, if save_plots = TRUE will output the tableGrob.
Charlie Marsh (charlie.marsh@mailbox.org) & Yoni Gavish
set.seed(111) envSet <- create_env_nsets(cellDims = c(25, 25), sets = c(2, 2, 2, 1), model = "Sph", psill = 1.5, dep1 = 1, rangeFun = function() exp(runif(1, 1, 6)), propSamp = 0.1) ### generate a virtual species from the variables sp <- create_sp(envStack = envSet, spFun = "x[1] * x[3] * x[5]", spModel = "Sph", spPsill = 1, spRange = 500, propSamp = 0.5, prev = 0.25) ### an initial 'sample' of the species (assuming perfect detection) sampPts <- data.frame(sampleRandom(sp$presence, 15, na.rm = TRUE, xy = TRUE)) ### a formula to fit to random forest (additive for all vars + quadratics) form <- paste0("presence ~ ", paste(names(envSet), collapse = " + "), "+ I(", paste(names(envSet), collapse = " ^ 2) + I("), " ^ 2)") ### run the initial model spMod <- sdmModelling(samples = sampPts, envStack = envSet, modFormula = form, ntrees = 500, plot = FALSE) ### the full set of unsampled points to profile unsampPts <- expand.grid(x = 1:25, y = 1:25) unsampPts <- unsampPts[!paste(unsampPts$x, unsampPts$y) %in% paste(sampPts$x, sampPts$y), ] profile <- sdmProfiling(unsampledCoords = unsampPts, sampledCoords = sampPts, origSDM = spMod, envStack = envSet, sdmFun = "sdmModelling", sdmFunArgs = list(samples = NULL, envStack = envSet, modFormula = form, ntrees = 100), parallel = FALSE) ### simple plot of points rgbPlot(profile = profile, origSDM = spMod) ### you can specify how to map the red-green-blue colours ### the top right (dual_col) can be either green (default) or purple rgbPlot(profile = profile, origSDM = spMod, dual_col = "purple", absence_col = "red") ### the bottom right (absence_col) can be either red (default) or blue rgbPlot(profile = profile, origSDM = spMod, dual_col = "purple", absence_col = "blue")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.