Learn R Programming

secr (version 1.3.0)

plot.mask: Plot Habitat Mask

Description

Plot a habitat mask either as points or as an image plot. Colours may be used to show the value of one mask covariate.

Usage

## S3 method for class 'mask':
plot(x, border = 20, add = F, covariate = NULL, axes = F,
    dots = T, col = "grey", ppoly = T, polycol = "red", \dots)

Arguments

x
mask object
border
width of blank display border (metres)
add
logical for adding mask points to an existing plot
covariate
name (as character string in quotes) or column number of a covariate to use for colouring
axes
logical for plotting axes
dots
logical for plotting mask points as dots, rather than as image plot
col
colour(s) to use for plotting
ppoly
logical for whether the bounding polygon should be plotted (applies only if mask type = 'polygon')
polycol
colour for outline of polygon (ppoly = TRUE)
...
other arguments passed to eqscplot

Details

The argument dots selects between two distinct types of plot; see image for more on image plots. If using a covariate to colour points, the col argument should be a colour vector of length > 1; the default is heat.colors(12).

See Also

colours, mask

Examples

Run this code
# simple

temptrap <- make.grid()
tempmask <- make.mask(temptrap)
plot (tempmask)

## restrict to points over an arbitrary detection threshold,
## add covariate, plot image and overlay traps

tempmask <- subset(tempmask, pdot(tempmask,temptrap)>0.001)

covariates (tempmask) <- data.frame(circle = 
    exp(-(tempmask$x^2 + tempmask$y^2)/10000) )

plot (tempmask, covariate = 'circle', dots = FALSE, axes = TRUE, 
    add = TRUE, col = terrain.colors(256))
plot (temptrap, add = TRUE)

## add a legend

par(cex = 0.9)
covrange <- range(covariates(tempmask)$circle)
step <- diff(covrange)/8
colourlev <- terrain.colors(256)[seq(1,256,(256-1)/8)]
zlev <- formatC(seq(covrange[1],covrange[2],step), format='f', 
    digits=2, width=4)
legend (x = 'topright', fill = colourlev, legend = zlev, 
    y.intersp = 0.8, title = 'Covariate')

title('Colour mask points with p.(X) > 0.001')
mtext(side=3,line=-1, 'g0 = 0.2, sigma = 20, nocc = 5')

Run the code above in your browser using DataLab