Learn R Programming

secrlinear (version 1.2.4)

plotmethods: Plot Methods for linearmask and linearpopn objects

Description

Custom plotting.

Usage

# S3 method for linearpopn
plot(x, ..., jitter = 0, plotline = TRUE)

# S3 method for linearmask plot(x, ..., linecol = 'black', label = FALSE, laboffset = c(spacing(x), 0))

Value

plot.linearpopn does not return a value.

plot.linearmask invisibly returns legend details as for plot.mask.

Arguments

x

linearpopn object from sim.linearpopn, or a linearmask object from read.linearmask

...

For plot.linearpopn: other arguments passed to plot.popn(may include add = TRUE). For plot.linearmask: other arguments passed to plot.mask (e.g., col, cex, add), to legend (pt.cex) or to the plot method for SpatialLines (lwd, lty)

jitter

numeric value for jittering

plotline

logical; if TRUE the mask line is overplotted in grey

linecol

line colour for linear habitat (see Color Specification in par)

label

logical; if TRUE each vertex is numbered

laboffset

offset of label from point (metres)

Details

The linear mask used for plotting a `linearpopn' is the one saved as an attribute of the object.

The main plotting in plot.linearmask is done by plot.mask with dots = TRUE. See the help for plot.mask for details of options such as add. The lines of the SpatialLinesdataFrame are overplotted unless linecol = NA.

Jittering shifts points by a random uniform distance -- (\(\pm 0.5 \times\) jitter) x mask spacing -- on both axes. This can give a better impression of density when points coincide.

The option inplot.popn for plotting rectangular `frame' is suppressed: do not attempt to pass this argument in ....

See Also

sim.linearpopn, plot.mask, plot.popn

Examples

Run this code
x <- seq(0, 4*pi, length = 200)
xy <- data.frame(x = x*100, y = sin(x)*300)
mask <- read.linearmask(data = xy, spacing = 10)
linpop <- sim.linearpopn(mask, 100)
plot(linpop, jitter = 2)

plot(mask)

## thicker band of grey points, dashed line
plot(mask, cex = 2, lty = 2)

## add a covariate, the distance downstream from the first mask point
downstrm <- networkdistance(glymemask, glymemask[1,], glymemask)[,1]
covariates(glymemask)<- data.frame(downstream = downstrm)

## point colour determined by a covariate
plot(glymemask, cex = 2, covariate = 'downstream', pt.cex = 2)

## point size determined by a covariate
plot(glymemask, cex = covariates(glymemask)$downstream/50, pch = 21)

Run the code above in your browser using DataLab