View source: R/plot_optimization.R
plot_optimization | R Documentation |
Plots optimization data frames produced by select_spatial_predictors_sequential()
and select_spatial_predictors_recursive()
.
plot_optimization( model, point.color = viridis::viridis( 100, option = "F", direction = -1 ), verbose = TRUE )
model |
A model produced by |
point.color |
Colors of the plotted points. Can be a single color name (e.g. "red4"), a character vector with hexadecimal codes (e.g. "#440154FF" "#21908CFF" "#FDE725FF"), or function generating a palette (e.g. |
verbose |
Logical, if |
If the method used to fit a model with rf_spatial()
is "hengl", the function returns nothing, as this method does not require optimization.
A ggplot.
if(interactive()){ #loading example data data(distance_matrix) data(plant_richness_df) #names of the response and predictors dependent.variable.name <- "richness_species_vascular" predictor.variable.names <- colnames(plant_richness_df)[5:21] #spatial model model <- rf_spatial( data = plant_richness_df, dependent.variable.name = dependent.variable.name, predictor.variable.names = predictor.variable.names, distance.matrix = distance_matrix, distance.thresholds = 0, method = "mem.moran.sequential", n.cores = 1, seed = 1 ) #plotting selection of spatial predictors plot_optimization(model = model) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.