Create a Leaflet map highlighting extreme values in an SDM output. This can either be minimum, maximum or both values set as a quantile.

sdm_highlight(
  sdm,
  quantile,
  both.sides = FALSE,
  pts = NULL,
  pal = NULL,
  crs = "standard",
  cluster = FALSE,
  simplify = TRUE
)

# S4 method for Raster
sdm_highlight(
  sdm,
  quantile,
  both.sides = FALSE,
  pts = NULL,
  pal = NULL,
  crs = "standard",
  cluster = FALSE,
  simplify = TRUE
)

# S4 method for data.frame
sdm_highlight(
  sdm,
  quantile,
  both.sides = FALSE,
  pts = NULL,
  pal = NULL,
  crs = "standard",
  cluster = FALSE,
  simplify = TRUE
)

Arguments

sdm

The SDM/ENM result. Should be a data.frame (XYZ columns) or in the Raster* format.

quantile

A single numeric value between 0 and 1 indicating which quantile to use (will be the same for both sides, if `both.sides` set to `TRUE`). For example, if you want the 25 percent higher values, you can set the quantile to 0.75. If you want both higher and lower 25 percent, just put 0.75, and set `both.sides = TRUE`. Note: setting quantile 1 makes no sense, as it will be 100 percent. The same for setting it 0.5 and `both.sides = TRUE`.

both.sides

If set to TRUE, than both the higher and lower values will be ploted.

pts

A data frame containing the presence or presence/absence points (optional). The first column should be longitude (x) and the sencond latitude (y). In the case of presence/absence data, an additional collumn should be provided, coded as 0 (absence) and 1 (presence).

pal

Character string indicating the name of the continuous mode palette (see gen_pal). If not supplied, the default will be used.

crs

Enables to change the default projection used in the Leaflet package. For now, not functional.

cluster

Should the points be clustered (i.e., aggregated)? Only valid if `pts` is supplied. Default is FALSE.

simplify

Should the polygons be simplified? If TRUE, the output became lighter.

Value

A Leaflet map.

Functions

  • sdm_highlight,Raster-method: Method for Raster*

  • sdm_highlight,data.frame-method: Method for data frames

Examples

library(sdmvis) # Load data data("original_sdm") data("pa_data") # Plot sdm_highlight(sdm = original_sdm[[1]], quantile = .75, pts = pa_data, both.sides = TRUE)
#> Warning: Discarded ellps WGS 84 in Proj4 definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs
#> Warning: Discarded datum World Geodetic System 1984 in Proj4 definition
#> Warning: Discarded ellps WGS 84 in Proj4 definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs
#> Warning: Discarded datum World Geodetic System 1984 in Proj4 definition
#> Warning: input and ouput crs are the same
#> Warning: Discarded ellps WGS 84 in Proj4 definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs
#> Warning: Discarded datum World Geodetic System 1984 in Proj4 definition
#> Warning: Some values were outside the color scale and will be treated as NA
#> Warning: CRS object has comment, which is lost in output
#> Warning: CRS object has comment, which is lost in output
#> Warning: longer object length is not a multiple of shorter object length