plotOverlaps | R Documentation |
Plot specific dBBMM overlapping areas for a specific combination of groups and, if relevant, a specific timeslot. If the base raster is in a geographic coordinate system, plotOverlaps will attempt to convert the dbbmm results to that same geographic system, so everything falls in place.
plotOverlaps(
overlaps,
areas,
base.raster,
groups,
timeslot,
level,
title = NULL,
col,
land.col = "#BABCBF80"
)
overlaps |
An overlap object as returned by |
areas |
The areas object used to calculate the overlaps. |
base.raster |
The raster used in the dbbmm calculations. |
groups |
Character vector indicating the two groups to be displayed. |
timeslot |
The timeslot to be displayed. Only relevant for timeslot dbbmms. |
level |
Value of the use area to plot. Must match one the levels calculated in the overlaps. |
title |
Plot title. By default, the names of the groups being compared are displayed. |
col |
Character vector of three colours to be used in the plot (one for each group and one for the overlap). |
land.col |
Colour of the land masses. Defaults to semi-transparent grey. |
If one of your groups has more than one usage area, or an overlaps contour has more than one area (both potentially caused by having multiple tags/tracks in a single group), ggplot2 will issue the following warning when plotting the map: Warning message: Raster pixels are placed at uneven horizontal intervals and will be shifted. Consider using geom_tile() instead. This is simply because empty cells are cleared out to improve plotting efficiency, which means there will be an empty space between the multiple areas to be drawn. Please be aware that this has no effect on the plot itself.
A plot of the overlapping areas between two groups.
# Import river shapefile
water <- actel::shapeToRaster(shape = paste0(system.file(package = "RSP"), "/River_latlon.shp"),
size = 0.0001, buffer = 0.05)
# Create a transition layer with 8 directions
tl <- actel::transitionLayer(x = water, directions = 8)
# Import example output from actel::explore()
data(input.example)
# Run RSP analysis
rsp.data <- runRSP(input = input.example, t.layer = tl, coord.x = "Longitude", coord.y = "Latitude")
# Run dynamic Brownian Bridge Movement Model (dBBMM)
dbbmm.data <- dynBBMM(input = rsp.data, base.raster = water, UTM = 56)
# Get dBBMM areas at group level
areas.group <- getAreas(dbbmm.data, type = "group", breaks = c(0.5, 0.95))
# Get overlaps between groups
overlap.data <- getOverlaps(areas.group)
# Plot overlaps
plotOverlaps(overlaps = overlap.data, areas = areas.group, base.raster = water,
groups = c("G1", "G2"), level = 0.95)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.