demotrap <- make.grid()
tempcapt <- sim.capthist(demotrap,
popn = list(D = 5, buffer = 50),
detectpar = list(g0 = 0.15, sigma = 30))
plot(tempcapt, border = 10, rad = 3, tracks = TRUE,
lab1cap = TRUE, laboffset = 2.5)
## type = n.per.cluster
## generate some captures
testregion <- data.frame(x = c(0,2000,2000,0),
y = c(0,0,2000,2000))
popn <- sim.popn (D = 10, core = testregion, buffer = 0,
model2D = "hills", details = list(hills = c(-2,3)))
t1 <- make.grid(nx = 1, ny = 1)
t1.100 <- make.systematic (cluster = t1, spacing = 100,
region = testregion)
capt <- sim.capthist(t1.100, popn = popn, noccasions = 1)
## now plot captures ...
temp <- plot(capt, title = "Individuals per cluster",
type = "n.per.cluster", hidetraps = FALSE,
gridlines = FALSE, cappar = list(cex = 1.5))
if (interactive()) {
## add legend; click on map to place top left corner
legend (locator(1), pch = 21, pt.bg = temp$colour,
pt.cex = 1.3, legend = temp$legend, cex = 0.8)
}
if (FALSE) {
## try varying individual colours - requires RColorBrewer
library(RColorBrewer)
plot(infraCH[[2]], icolours = brewer.pal(12, "Set3"), tracks = TRUE,
bg = "black", cappar = list(cex = 2), border = 10, rad = 2,
gridlines = FALSE)
## generate telemetry data
te <- make.telemetry()
tr <- make.grid(detector = "proximity")
totalpop <- sim.popn(tr, D = 20, buffer = 100)
tepop <- subset(totalpop, runif(nrow(totalpop)) < 0.05)
teCH <- sim.capthist(te, popn = tepop, renumber=FALSE, detectfn = "HHN",
detectpar = list(lambda0 = 3, sigma = 25))
plot(teCH, type = 'telemetry', tracks = TRUE)
## simple "centres" example
## polygon data require 'hazard' detection function 14:19
CH <- sim.capthist(make.poly(), nocc = 20, detectfn = 'HHN',
detectpar = list(lambda0 = 1, sigma = 10))
plot(CH, cappar = list(col = 'orange'), varycol = FALSE, border = 10)
plot(CH, type = 'centres', add = TRUE, rad = 0)
}
Run the code above in your browser using DataLab