inst/userguide/figures/CS5--Cs08_code-to-plot.R

###################################################
### code chunk number 10: Cs08_code-to-plot
###################################################
# Code to plot estimated turtle track against observations
# The estimates
pred.lon <- kem$states[1, ]
pred.lat <- kem$states[2, ]

par(mai = c(0, 0, 0, 0), mfrow = c(1, 1))
library(maps)
pdat <- loggerheadNoisy
turtlename <- "BigMama"
map("state",
  region = c(
    "florida", "georgia", "south carolina",
    "north carolina", "virginia", "delaware", "new jersey", "maryland"
  ),
  xlim = c(-85, -70)
)
points(pdat$lon[theTurtle], pdat$lat[theTurtle],
  col = "blue", pch = 21, cex = 0.7
)
lines(pred.lon, pred.lat, col = "red", lwd = 2)

goodturtles <- loggerhead
gooddat <- goodturtles[which(goodturtles$turtle == turtlename), 5:6]
points(gooddat[, 1], gooddat[, 2], col = "black", lwd = 2, pch = 3, cex = 1.1)
legend("bottomright", c(
  "bad locations", "estimated true location",
  "good location data"
),
pch = c(1, -1, 3), lty = c(-1, 1, -1),
col = c("blue", "red", "black"), bty = FALSE
)
nwfsc-timeseries/MARSS documentation built on June 3, 2023, 1:32 p.m.