【发布时间】:2018-10-05 15:17:59
【问题描述】:
我一直在使用来自不同数据集 (MR + MRTag) 的 geom_point 绘制两组位置数据。
MR
detect_date Latitude Longitude species
12/04/2016 11:08 -6.6524 71.3475 Manta Ray
12/04/2016 11:09 -6.6524 71.3475 Manta Ray
12/04/2016 11:10 -6.6524 71.3475 Manta Ray
16/04/2016 21:27 -6.6524 71.3475 Manta Ray
MRTag
species taggingdate deploy_lat deploy_lon
Manta Ray 3/24/2016 -5.4191 71.83855
Manta Ray 02/05/2013 -5.2568 71.65768333
Manta Ray 02/07/2013 -5.33448 71.9812
Manta Ray 02/08/2013 -5.3046 71.94231667
然后我用下面的代码制作了一张底图
library(ggmap)
MR_bbox <- make_bbox(lon = MR$Longitude, lat = MR$Latitude, f=1)
MR_map <- get_map(location = MR_bbox, source = "google", maptype = "satellite")
然后将我的位置数据从 Mr + MRTag 绘制到地图上
MR_plot <-
ggmap(MR_map) +
geom_point(data = MR, mapping = aes(x = Longitude, y = Latitude),
shape = 1, color = "white") +
geom_point(data = MRTag, mapping = aes(x = deploy_lon, y = deploy_lat),
shape = 25, fill = "#00FF00", color = "#00FF00") +
xlab("Longitude") +
ylab("Latitude")
这给了我这个情节
我想在地图上添加两个形状的图例,但我不确定最好的方法,而且方法到目前为止还没有奏效
【问题讨论】:
-
欢迎来到 SO。请提供一个可重现的例子。这将为想要帮助您的人提供一些可以使用和测试的东西。你可以阅读它here。
-
希望对您有所帮助