separating overlapping plots while retaining lat/long location ggmap

17 Views Asked by At

I have many points on a global map, several of which have lat/long locations very near to one another. I would like to separate these locations out while creating a line that connects the point to the real lat/long. For example, here is an example of what I want: enter image description here

This code creates what I have, where latlong.txt is below. Please let me know if this is possible!

library(ggmap) 
library(maps)
     
latlong <- read.table("latlong.txt",sep="\t",header=TRUE)

mapWorld <- borders("world", colour="grey", fill="grey")

mp <- ggplot() + mapWorld 

fullmap <- mp +  
  geom_point(data=latlong, aes(x=Longitude, y=Latitude, fill=Method, size=Samples),
                            shape=21, color="black") +   
  theme_linedraw() +   
  labs(x="Longitude", y="Latitude") 

print(fullmap)

Data

latlong <- structure(list(Samples = c(25L, 8L, 22L, 142L, 120L, 88L, 234L, 
31L, 2L, 51L, 38L, 14L, 2L, 32L, 6L, 156L, 116L, 11L, 10L, 10L, 
6L, 20L, 4L, 9L, 446L, 2L, 14L, 26L), Paper = c("Shubenkova", 
"Colwell", "Bidle", "Inagaki_PR", "Inagaki_HR", "Inagaki_TB", 
"Inagaki_OK", "Marchesi", "Meyerdierks", "Nunoura", "Reed", "Briggs", 
"Kadnikov", "Ruff", "Nema", "Klasek", "Carrier", "Beckman", "Beckman", 
"Beckman", "Beckman", "Katayama", "Grundger", "Liu", "Lee", "Cabello-Yeves", 
"Penev", "Zhang"), Year = c(2005L, 2005L, 1999L, 2006L, 2006L, 
2006L, 2003L, 2001L, 2005L, 2008L, 2002L, 2012L, 2012L, 2018L, 
2019L, 2021L, 2020L, 2021L, 2021L, 2021L, 2021L, 2016L, 2019L, 
2022L, 2016L, 2020L, 2020L, 2023L), Method = c("cct", "cct", 
"cct", "cct", "cct", "cct", "cct", "cct", "cct", "cct", "cct", 
"pyro", "pyro", "pyro", "sbs", "sbs", "sbs", "sbs", "sbs", "sbs", 
"sbs", "sbs", "sbs", "sbs", "wgs", "wgs", "wgs", "wgs"), Location = c("Lake Baikal", 
"Richards Island, Mackenzie Delta, Northwest Territories, Canada", 
"Cascadia Margin; ODP site 892B", "Peru Margin; ODP leg 201", 
"Cascadia Margin; ODP leg 204", "Trujillo basin; ODP leg 201", 
"Sea of Okhotsk", "Cascadia Margin; ODP leg 146", "Hydrate Ridge", 
"Cascadia Margin; ODP leg 204", "Nankai Trough", "Andaman Sea", 
"Lake Baikal", "Håkon Mosby", "Krishna Godavari Basin", "Storfjordrenna", 
"Storfjordrenna", "Baltimore Canyon", "Pacific Margin", "Washington Canyon", 
"Blake Ridge", "Nankai Trough", "Storfjordrenna", "Qiongdongnan Basin", 
"Ulleung Basin", "Lake Baikal", "Hydrate Ridge", "Qiongdongnan Basin"
), Latitude = c(51.55, 69.27, 44.4, -9.675, 44.34, -8.594, 44.31, 
48.41, 44.34, 44.35, 34.12, 10.45, 52.52, 72, 15.3, 76.062, 76.0626, 
38.04, 52.01, 37.33, 32.49, 33.56, 76.06703, 17, 36.55, 51.5, 
44.35, 18), Longitude = c(105.38, -134.39, -125.07, -80.35, -125.09, 
-79.573, 145, -126.52, -125.08, -125.7, 137.45, 93.6, 107.09, 
14.72, 80.82, 15.5757, 16.0442, -73.82, -131.45, -74.44, -76.18, 
137.19, 16.00162, 110, 130.54, 104.47, -125.71, 111)), class = "data.frame", row.names = c(NA, 
-28L))
0

There are 0 best solutions below