library(gapminder)
library(dplyr)
library(gganimate)
gapminder %>%
ggplot(aes(x = gdpPercap, y = lifeExp, size = pop, color = continent)) +
geom_point() +
scale_x_log10() +
transition_manual(frames = year) +
ggdark::dark_theme_bw() + #设置黑色主题
labs(title = paste('Year:', '{current_frame}'))#设置标题跟随当前的年份变化,即current_frame。
动态图.gif
网友评论