I have a data set with observations by day and hour for a series of organisms.
I want to plot each set of observations separately. However, when if there are no observations at the beginning of the time series it cuts that time off the axis (i.e., no animals seen on day 1 so axis starts on day 2) - as a result my plots have different axis's. Neither scale_y_discrete or continuous work for different reasons. This seems like it should be easy.
df <- data.frame("day"= c(1, 1, 1, 2, 2, 2, 3, 3, 3),"hour" = c(1, 2, 3, 1, 2, 2, 1, 2, 3),"a" = c("Y", "Y", "N", "N", "N", "Y", "N", "N", "N"), "b" = c("N", "N", "Y", "N", "N", "Y", "Y", "N", "Y")) #example data
df %>%
pivot_longer(cols = a) %>%
filter(value == 'Y') %>% #I only want to display Y or positive observations
mutate(across(c(day, hour), factor)) %>%
ggplot() + aes(day, hour, color = name) + geom_point()