我使用gapminder数据集对亚洲的预期寿命进行了以下数据可视化,如何根据预期寿命较高的国家来更改图表以对其进行排序?
这是我的代码:
install.packages("gapminder")
library(gapminder)
Asia_sample2 <- gapminder %>% filter (gapminder$continent =="Asia")
p1 <- ggplot(data = Asia_sample2, aes(x = year , y = country , fill = lifeExp ))
p1 + geom_raster() +scale_fill_gradient(low="blue", high="red") +
theme_bw() +
labs(title = "Estimated Life Expectancy in Asia , Years(1952-2007)")