Skip to contents

Creates a map of a distance-decay raster and optionally crops the map around a colony location.

Usage

plot_DD_map(
  DD_map,
  colony = NULL,
  km_to_left = 30,
  km_to_right = 50,
  km_up = 30,
  km_down = 70,
  crop = FALSE,
  title = "Distance-decay map"
)

Arguments

DD_map

A raster::RasterLayer object containing distance-decay values.

colony

An sf point object containing the colony location. This is required when crop = TRUE and must use a projected coordinate reference system with coordinates measured in metres.

km_to_left

Non-negative numeric scalar giving the distance, in kilometres, to extend the cropped area west of the colony. Defaults to 30.

km_to_right

Non-negative numeric scalar giving the distance, in kilometres, to extend the cropped area east of the colony. Defaults to 50.

km_up

Non-negative numeric scalar giving the distance, in kilometres, to extend the cropped area north of the colony. Defaults to 30.

km_down

Non-negative numeric scalar giving the distance, in kilometres, to extend the cropped area south of the colony. Defaults to 70.

crop

Logical scalar indicating whether DD_map should be cropped around colony. Defaults to FALSE.

title

Character string giving the plot title. Defaults to "Distance-decay map".

Value

A ggplot2::ggplot() object showing the distance-decay raster.

Details

When crop = FALSE, the complete raster is plotted.

When crop = TRUE, colony must be supplied. The plotting extent is calculated using the four directional distances. These distances are converted from kilometres to metres, so the colony and raster must use a projected coordinate reference system with coordinates measured in metres.

Examples

if (FALSE) {
# Plot the complete distance-decay map
plot_DD_map(DD_map)

# Plot the map cropped around a colony
plot_DD_map(
  DD_map = DD_map,
  colony = colony,
  crop = TRUE
)
}