plot: Plot speciesRaster

plot.speciesRasterR Documentation

Plot speciesRaster

Description

Plot a speciesRaster object.

Usage

## S3 method for class 'speciesRaster'
plot(
  x,
  log = FALSE,
  colorRampRange = NULL,
  legend = TRUE,
  col = c("blue", "yellow", "red"),
  basemap = "worldmap",
  box = TRUE,
  axes = TRUE,
  location = "right",
  add = FALSE,
  singleSpCol = gray(0.9),
  ...
)

Arguments

x

object of class speciesRaster

log

boolean; should the cell values be logged?

colorRampRange

numeric vector of min and max value for scaling the color ramp. Automatically inferred if set to NULL. This is relevant if multiple plots are desired on the same scale. See getMultiMapRamp. Not intended for leaflet option.

legend

boolean; should legend be included?

col

either a vector of color names that will be interpolated, or a color ramp function that takes an integer (see for example colorRampPalette)

basemap

if none, then only the raster is plotted. If 'worldmap', then vector map is plotted. If 'leaflet', then the leaflet package is used.

box

boolean; should box be drawn around plot?

axes

boolean; should axes be included?

location

location of legend, if included. See addRasterLegend.

add

Logical. Wether to add to current plot

singleSpCol

color for single-species cells. See details.

...

additional parameters will be passed to the addRasterLegend function.

Details

If x is a metric as generated with cellMetrics_speciesRaster that returns 0 for single-species cells, then those cells (that have a value of 0) will be plotted in gray (or any color as specified with singleSpCol).

Value

Nothing is returned.

Author(s)

Pascal Title

Examples

plot(tamiasSpRas)

plot(tamiasSpRas, legend=FALSE, axes=FALSE, box=FALSE)
addRasterLegend(tamiasSpRas, location = 'top', ramp=c('blue','yellow','red'))

# Example for how to plot multiple speciesRasters on the same color scale
# for illustration purposes, we will compare weighted endemism to
# phylogenetic weighted endemism
tamiasSpRas <- addPhylo_speciesRaster(tamiasSpRas, tamiasTree)
spRas1 <- cellMetrics_speciesRaster(tamiasSpRas, metric='weightedEndemism')
spRas2 <- cellMetrics_speciesRaster(tamiasSpRas, metric='phyloWeightedEndemism')
# get global min and max values
minmax <- getMultiMapRamp(list(spRas1, spRas2))
par(mfrow = c(1,2))
plot(spRas1, colorRampRange = log(minmax), log = TRUE, location='right')
plot(spRas2, colorRampRange = log(minmax), log = TRUE, location='left')


# use leaflet for plotting
plot(tamiasSpRas, basemap = 'leaflet')



ptitle/speciesRaster documentation built on June 11, 2022, 1:35 a.m.