devtools::install_github('thomasp85/gganimate')
library(gganimate)
library(ggplot)
set.seed(123)
rain.data <- data.frame(ID = 1:50, year = rep(1981, times = 365*50),
doy = rep(1:365, times = 50), rain = rnorm(365*50))
For a single day, If I want to plot the rain value across all ID
rain.data %>% dplyr::filter(doy == 1) %>% ggplot(., aes(rain)) + geom_histogram()
If want to create an animation of rain for each day of the year, I did this:
ggplot(rain.data, aes(rain)) + geom_histogram(show.legend = FALSE) +
labs(title = 'Doy: {frame_time}', x = 'Rain', y = '# Count') +
transition_time(doy)
This does not look right and definitely not a histogram. What am I doing wrong?