Skip to contents

Create a composite plots contrasting the distribution of multiple variables for presences vs the background.

Usage

plot_pres_vs_bg(.data, .col)

Arguments

.data

a data.frame (or derived object, such as tibble::tibble, or sf::st_sf) with values for the bioclimate variables for presences and background

.col

the column containing the presences; it assumes presences to be the first level of this factor

Value

a patchwork composite plot

Examples

# \donttest{
data("bradypus", package = "maxnet")
bradypus_tb <- tibble::as_tibble(bradypus) %>%
  dplyr::mutate(presence = relevel(
    factor(
      dplyr::case_match(presence, 1 ~ "presence", 0 ~ "absence")
    ),
    ref = "presence"
  )) %>%
  select(-ecoreg)

bradypus_tb %>% plot_pres_vs_bg(presence)

# }