我对使用R语言进行编码还很陌生。我正在尝试使用gganimate为我的图形设置动画。我已经尝试了一段时间。这是代码:
ggplot(gapminder, aes(PerCapGDP, PerCapFT, size = PerCapPHE, color=Province)) +
scale_colour_manual(values = country_colors)+
geom_point(alpha = 0.7, show.legend = FALSE) +
scale_size(range = c(2,12))+
scale_x_log10()+
facet_wrap(~Province) +
labs(title = 'Year: {frame_time}', x = 'GDP per capita', y = 'life expectancy') +
transition_time(Year) +
ease_aes('linear')
运行此代码时出现此错误:
错误:至少一层必须包含所有构面变量:
Province
。 *情节缺失Province
*第1层缺少Province
预先感谢您的帮助!