Closed qgeissmann closed 6 years ago
I think we are there, with the time_offset
argument:
metadata <- data.table(id= sprintf("toy_experiment|%02d", 1:20),
condition=c("A","B"))
dt <- toy_activity_data(metadata, 3)
dt[, moving := ifelse(t %% hours(24) > hours(12), moving & rnorm(.N) > -.2, moving)]
my_layers <- list(stat_pop_etho(), stat_ld_annotations())
pl_a <- ggetho(dt, aes(y=moving), time_wrap=hours(24)) + my_layers
pl_b <- ggetho(dt, aes(y=moving), time_wrap=hours(24), time_offset = hours(12)) + my_layers
pl_c <- ggetho(dt, aes(y=moving), time_wrap=hours(24), time_offset = hours(6)) + my_layers
pl_d <- ggetho(dt, aes(y=moving), time_wrap=hours(24), time_offset = hours(-6)) + my_layers
cowplot::plot_grid(pl_a,pl_b,pl_c,pl_d, labels=letters[1:4])
if #11 is closed, we can do that rather simply