outline.buffer: Get a composite buffer in a format suitable for plotting its...

View source: R/outline.buffer.R

outline.bufferR Documentation

Get a composite buffer in a format suitable for plotting its outline

Description

Get a buffer (i.e. a non-circular buffer as produced by combine.buffers()) in a format suitable for plotting its outline. outline.buffer() replaces any NA values in a buffer or bathy object by 0 and non-NA values by -1.

Usage

outline.buffer(buffer)

Arguments

buffer

a buffer object of class bathy (i.e. bathy matrix containing depth/altitude values within the buffer and NAs outside)

Details

This function is essentially used to prepare a composite buffer for plotting its outline on a bathymetric map. Plotting a single circular buffer should be done using the plot.buffer() function since it offers a more straightforward method for plotting and much smoother outlines, especially for low-resolution bathymetries.

Value

An object of class bathy of the same dimensions as buffer containing only zeros (outside the buffer area) and -1 values (within the buffer).

Author(s)

Benoit Simon-Bouhet

See Also

create.buffer, combine.buffers, plot.bathy

Examples

# load and plot a bathymetry
data(florida)
plot(florida, lwd = 0.2)
plot(florida, n = 1, lwd = 0.7, add = TRUE)

# add points around which a buffer will be computed
loc <- data.frame(c(-80,-82), c(26,24))
points(loc, pch = 19, col = "red")

# create 2 distinct buffer objects with different radii
buf1 <- create.buffer(florida, loc[1,], radius=1.9)
buf2 <- create.buffer(florida, loc[2,], radius=1.2)

# combine both buffers
buf <- combine.buffers(buf1,buf2)

## Not run: 
# Add outline of the resulting buffer in red 
# and the outline of the original buffers in blue
plot(outline.buffer(buf), lwd = 3, col = 2, add=TRUE)
plot(buf1, lwd = 0.5, fg="blue")
plot(buf2, lwd = 0.5, fg="blue")

## End(Not run)

marmap documentation built on March 31, 2023, 6:59 p.m.