【发布时间】:2018-04-25 12:17:30
【问题描述】:
我正在尝试将图例添加到由 R 中的 ggmap 包生成的绘图中。我正在使用的数据集是
Latitude Longitude amount
61.37072 -152.40442 436774
32.80667 -86.79113 3921030
34.96970 -92.37312 1115087
33.72976 -111.43122 5068957
我使用的代码是
library(ggplot2)
library(ggmap)
MyMap <- get_map(location = c(lon = -96.5, lat = 40.68925), zoom = 4,maptype = "terrain", scale = 2)
ggmap(MyMap)+
geom_point(data = data,aes(x = Longitude , y = Latitude ),size=sqrt(data$amount)/800,col='darkred', shape = 19,alpha = .5)
现在我想为这个情节添加图例。图例应显示地图上圆圈的大小对应于一定数量。我该怎么做?
【问题讨论】:
-
尝试把“size”放到aes-funktion里面。