psolymos / bSims

Bird Point Count Simulator
https://peter.solymos.org/bSims/
4 stars 1 forks source link

Add removal plot to events and detections #8

Closed psolymos closed 5 years ago

psolymos commented 5 years ago

Add events accumulation plot for objects returned by get_events and get_detections.

See https://peter.solymos.org/qpad-book/behavior.html#vocalization-events

psolymos commented 5 years ago
v <- get_events(object)
v1 <- v[!duplicated(v$i),]

tmp <- v1
tmp$o <- seq_len(nrow(v1))
plot(o ~ t, tmp, type="n", ylab="Individuals",
  main="Vocalization events", 
  ylim=c(1, nrow(b$nests)), xlim=c(0,10))
for (i in tmp$o) {
  tmp2 <- v[v$i == v1$i[i],]
  lines(c(tmp2$t[1], 10), c(i,i), col="grey")
  points(tmp2$t, rep(i, nrow(tmp2)), cex=0.5)
  points(tmp2$t[1], i, pch=19, cex=0.5)
}