我正在尝试使用ggplot2 重新创建气泡图的可视化效果(我已经找到了在R中执行此操作的代码,但没有使用ggplot2包进行此操作)。到目前为止,这就是我所拥有的。目前,我的代码还存在其他一些错误,但是我希望图例显示同心圆的大小,而不是行中显示的圆。谢谢你的帮助!
原始可视化:

我的复制品:

我的(简体)代码:
crime <-
read.csv("http://datasets.flowingdata.com/crimeRatesByState2005.tsv",
header=TRUE, sep="\t")
ggplot(crime,
mapping= aes(x=murder, y=burglary))+
geom_point(aes(size=population), color="red")+
geom_text(aes(label=state.name), show.legend=FALSE, size=3)+
theme(legend.position = c(0.9, 0.2))
Run Code Online (Sandbox Code Playgroud)