我如何在R上实现这样的气泡图?
答案 0 :(得分:2)
要实现这一目标,您可以使用ggplot。这是一个例子:
require(ggplot2)
df <- data.frame(x = c(-2, -1.5, 1, 2, 3),
y = c(-1, 0.8, 1, 1, 2),
country = c("SWI", "FRA", "US", "UK", "NL"), size = c(15,12,20,4,7))
ggplot(df, aes(x = x, y = y)) + geom_point(aes(size = size), pch=1) +geom_text(aes(label=country),hjust=-0.5, vjust=0) + xlim(c(-3,4)) + scale_size_continuous(range = c(2,20))