plot,CaribouHabitat,ANY-method | R Documentation |
CaribouHabitat
ObjectsPlot the predicted habitat use from a CaribouHabitat
object.
## S4 method for signature 'CaribouHabitat,ANY'
plot(
x,
season = "all",
raster.title = "Probability\nof use",
tmap = requireNamespace("tmap", quietly = TRUE),
...
)
x |
A CaribouHabitat object |
season |
character. By default "all" or supply a vector of seasons ie
|
raster.title |
character. Title to give map |
tmap |
logical. Should tmap be used for plotting by default it is used if installed |
... |
Other agruments passed to |
If tmap is TRUE a tmap object if FALSE a plot is created in the viewer
# create example rasters
lc <- terra::rast(xmin = 0, xmax = 25000, ymin = 0, ymax = 25000,
resolution = 250, crs = "EPSG:5070")
lc[] <- 0
nd <- lc
nd[1:30, 1:30] <- 1
ad <- lc
ad[30:50, 3:50] <- 1
lc[] <- 1
lc[70:100, 70:100] <- 2
# create sf objects
lf <- sf::st_as_sf(sf::st_sfc(list(sf::st_linestring(matrix(c(0, 0, 10000, 10000),
ncol = 2, byrow = TRUE))),
crs = 5070))
esk <- sf::st_as_sf(sf::st_sfc(list(sf::st_linestring(matrix(c(0, 10000, 10000, 0),
ncol = 2, byrow = TRUE))),
crs = 5070))
projPol <- sf::st_sf(sf::st_as_sfc(sf::st_bbox(ad)))
# calculate relative probability of use
res <- caribouHabitat(landCover = lc,
linFeat = lf,
esker = esk,
natDist = nd,
anthroDist = ad,
projectPoly = projPol,
caribouRange = "Nipigon",
winArea = 1000 #leave as default NULL except for small examples
)
# plot the relative probability of use for each season
plot(res)
# plot for one season
plot(res, season = "Winter")
if(requireNamespace("tmap", quietly = TRUE)){
# pass arguments on to tmap::qtm
plot(res, raster.style = "cont", title = "Main title",
raster.title = "Legend title")
}
# force plot with base graphics arguments passed to terra::plot()
plot(res, tmap = FALSE, main = c("title1", "title2"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.