
Last chance! 50% off unlimited learning
Sale ends in
image
plot. Colours maybe used to show the value of one mask covariate.## S3 method for class 'mask':
plot(x, border = 20, add = FALSE, covariate = NULL, axes = FALSE,
dots = TRUE, col = "grey", breaks = 12, meshcol = NA, ppoly = TRUE,
polycol = "red", \dots)
## S3 method for class 'Dsurface':
plot(x, covariate = "D", group = NULL, plottype =
"shaded", scale = 1, ...)
spotHeight (object, prefix = NULL, dec = 2, point = FALSE, text = TRUE,
sep = ", ", session = 1, scale = 1, ...)
ppoly
= TRUE)eqscplot
(in the case
of plot.mask
), plot.mask
(in the case of
plot.Dsurface
), and points
or text
(in the case of spotHeight
)Dsurface
covariate
is specified and plottype = shaded
then
plot.mask
invisibly returns a character vector of the intervals
defined by `breaks' (useful for plotting a legend).
If `plottype = persp' then plot.mask
invisibly returns a the
perspective matrix that may be used to add to the plot with
trans3d
.
spotHeight
invisibly returns a dataframe of the extracted
values and their coordinates.dots
of plot.mask
selects between two
distinct types of plot (dots and shaded (coloured) pixels).
plot.Dsurface
offers contour and perspective plots in addition to
the options in plot.mask
. It may take some experimentation to get
what you want - see contour
and
persp
.
If using a covariate or Dsurface to colour dots or pixels, the
col
argument should be a colour vector of length equal to the
number of levels (the default palette is heat.colors
, and this
palette will also be used whenever there are too few levels in the
palette provided; see Notes for more on palettes). Border lines around
pixels are drawn in `meshcol'. Set this to NA to eliminate pixel
borders.
If a covariate
is specified in a call to plot.Dsurface
then
that covariate will be plotted instead of density. This is a handy way
to contour a covariate (contouring is not available in plot.mask
).
If `breaks' is an integer then the range of the covariate is divided
into this number of equal intervals. Alternatively, `breaks' may be a
vector of break points (length one more than the number of
intervals). This gives more control and often `prettier'
spotHeight
may be used to interrogate a plot produced with
plot.Dsurface
, or by plot.mask
if the mask has
covariates. prefix
defaults to `density.' for Dsurface objects
and to `' (all covariates) for mask objects. The predicted density or
covariate at the nearest point is returned when the user clicks on the
plot. Multiple values may be displayed (e.g., prefix =
c("lcl","ucl")
if Dsurface includes confidence limits). Click outside
the mask or hit the Esc key to end. spotHeight
deals with one
session at a time.colours
,
mask
,
Dsurface
,
rectangularMask
,
contour
persp
# 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,
noccasions = 5)>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, breaks = 8, col = terrain.colors(8), mesh = NA)
plot (temptrap, add = TRUE)
## add a legend
par(cex = 0.9)
covrange <- range(covariates(tempmask)$circle)
step <- diff(covrange)/8
colourlev <- terrain.colors(9)
zlev <- format(round(seq(covrange[1],covrange[2],step),2))
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")
## possum density surface extrapolated across region
regionmask <- make.mask(traps(possumCH), buffer = 1000, spacing = 10,
poly = possumremovalarea)
dts <- distancetotrap(regionmask, possumarea)
covariates(regionmask) <- data.frame(d.to.shore = dts)
shorePossums <- predictDsurface(possum.model.Dsh2, regionmask)
## plot as coloured pixels with white lines
colourlev <- terrain.colors(7)
plot(shorePossums, breaks = seq(0,3.5,0.5), plottype = "shaded",
poly = FALSE, col = colourlev, mesh = NA)
plot(traps(possumCH), add = TRUE, detpar = list(col = "black"))
polygon(possumremovalarea)
## check some point densities
spotHeight(shorePossums, dec = 1, col = "black")
## add a legend
zlev <- format(seq(0,3,0.5), digits = 1)
legend (x = "topright", fill = colourlev, legend =
paste(zlev,"--"), y.intersp = 1, title = "Density / ha")
Run the code above in your browser using DataLab