Skip to content

Instantly share code, notes, and snippets.

@ylelkes
Created September 6, 2020 19:17
Show Gist options
  • Save ylelkes/f9d94c1e2af1fcdae0c6734ea566e14e to your computer and use it in GitHub Desktop.
Save ylelkes/f9d94c1e2af1fcdae0c6734ea566e14e to your computer and use it in GitHub Desktop.
mpg %>% group_by(cyl) %>% summarise(hwy=mean(hwy)) -> forplot
forplot$order <- c(1,2,3,4)
a <- ggplot(forplot, aes(x = cyl %>% as.factor(), y = hwy)) +
geom_bar(stat = 'identity')
plot <- a + transition_reveal(order)
animate(plot,nframes = 4,renderer = file_renderer("presentation//", prefix = "cars", overwrite = TRUE),
res=150,width=5,height=5,units="in")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment