问题
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