I was having trouble animating a geom_tile()
plot where the tile remains visible after it appears.
Here's my code using the airquality
data.
First, the static plot. Here, the x-axis is Day. The y-axis is Month and Temp is the fill.
library(gganimate)
anim <- ggplot(airquality, aes(x = Day, y = Month, fill = Temp)) +
geom_tile()
anim
Using transition_reveal()
doesn't visually preserve the Temp tiles as it traverses along Day.
anim1 <- anim + transition_reveal(Day)
anim1
I also tried this with transition_time()
with no luck.
Thanks for your help!