gen_pal.Rd
This is an accessory function to generate binary or 4 color palettes to be used in the leaflet maps.
gen_pal(mode, pal, type = "leaflet")
mode | Mode to generate the palette. "bin" is suitable for binary maps (thresholded maps). "quad" will return a 4 color palette, suitable for maps showing differences from a (binary) reference to a distinct scenario (either future or past). |
---|---|
pal | Which palete to use. Character string indicating the name of the palette. Can also be a character vector of colors, in which case two or four should be supplied. The following pre-seted (and tested) palettes are available and are recommended: These are the available palettes for binary maps:
These are the available color schemes for 4 colors maps:
All of these palettes are colorblind safe. For the continuous colors, you can use any of the palettes available for the colorNumeric function (see colorNumeric) (THIS FUNCTION WILL NOT WORK WITH CONTINUOUS COLORS. SUPPLY THE NAME DIRECTLY IN THE SDMVIS FUNCTIONS.). |
type | Which type of palette to return. If "leaflet" (default), a leaflet ready palette is returned. Any other value will return a character vector of colors. |
A palette to produce interactive SDM/ENM maps.
#>#>#> #> #> #> #> #> #> #> #> #> #>data(thresholded_sdm) binpal <- gen_pal(mode = "bin", pal = "BlGr") leaflet()%>% addProviderTiles("Esri.OceanBasemap") %>% addRasterImage(thresholded_sdm[[1]], colors = binpal, opacity = 0.9)#> 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: Some values were outside the color scale and will be treated as NA