custom column to frame title in gganimate

怎甘沉沦 提交于 2020-01-05 05:47:13

问题


I would like to use a custom column in gganimate title but couldn't read anywhere in docs how to do it.

Example using the code from their page:

library(gapminder)

ggplot(gapminder, aes(gdpPercap, lifeExp, size = pop, colour = country)) +
  geom_point(alpha = 0.7, show.legend = FALSE) +
  scale_colour_manual(values = country_colors) +
  scale_size(range = c(2, 12)) +
  scale_x_log10() +
  facet_wrap(~continent) +
  # Here comes the gganimate specific bits
  labs(title = 'Year: {frame_time}', x = 'GDP per capita', y = 'life expectancy') +
  transition_time(year) +
  ease_aes('linear')

I want 'GDP per capita' (Just a silly example I know) in title instead of year. I've tried replacing 8th line with:

labs(title = 'Gdp: {gdpPercap}', x = 'GDP per capita', y = 'life expectancy') +

No succcess so far

来源:https://stackoverflow.com/questions/53479557/custom-column-to-frame-title-in-gganimate

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!