Skip to contents

Plots optimization data frames produced by select_spatial_predictors_sequential() and select_spatial_predictors_recursive().

Usage

plot_optimization(
  model,
  point.color = viridis::viridis(
    100,
    option = "F",
    direction = -1
  ),
  verbose = TRUE
)

Arguments

model

A model produced by rf_spatial(), or an optimization data frame produced by select_spatial_predictors_sequential() or select_spatial_predictors_recursive().

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. viridis::viridis(100)). Default: viridis::viridis(100, option = "F", direction = -1)

verbose

Logical, if TRUE the plot is printed. Default: TRUE

Value

A ggplot, or NULL invisibly if no optimization data is available.

Details

The function returns NULL invisibly (without plotting) when:

  • The method used to fit a model with rf_spatial() is "hengl" (no optimization required)

  • No spatial predictors were selected during model fitting

  • The model is non-spatial

Examples


data(plants_rf_spatial)

plot_optimization(plants_rf_spatial)