編輯 經過三天的小興趣,我添加了一個完全可重複的例子...下面的代碼使1400個位置。前700點以第一區爲中心,第二700點以第二區爲中心向西北。有gvisMap可以繪製的最大點數嗎?或gvisMap不會繪製所有點
datOne <- data.frame(
Long = runif(700, -111.180000, -110.950000),
Lat = runif(700, 43.180000, 43.440000),
Area = "First")
datTwo <- data.frame(
Long = runif(700, -111.850000, -110.900000),
Lat = runif(700, 43.910000, 44.000000),
Area = "Second")
dat <- rbind(datOne, datTwo)
dat$LatLong <- paste(dat$Lat, dat$Long, sep = ":")
head(dat)
Long Lat Area LatLong
1 -110.9701 43.19509 First 43.1950901590148:-110.970063584852
2 -111.0258 43.25338 First 43.2533758980362:-111.025837010061
3 -111.1737 43.18016 First 43.180157370572:-111.173737878765
4 -111.1130 43.41193 First 43.4119294773275:-111.112970910808
5 -110.9909 43.34044 First 43.3404393909033:-110.990947539737
6 -110.9800 43.33428 First 43.3342766285082:-110.979969937215
如果我嘗試用gvisMap
積點則只能圍繞第一區域的中心位置在地圖apear如下面的代碼
library(googleVis)
M2 <- gvisMap(dat, "LatLong",
options=list(showLine=TRUE, enableScrollWheel=TRUE,
mapType='satlite', useMapTypeControl=TRUE,
width="800", height="800",
colors = "['#0000ff']",
icons=paste0("{","'default': {'normal':
'http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png',\n",
"'selected':'http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png'",
"}}")
))
plot(M2)
轉載確認所有的位置都正確格式化我可以將數據框子集劃分到包含兩個區域中的位置的點500:1000。將第一行代碼更改爲
M2 <- gvisMap(dat[500:1000, ], "LatLong",
將在兩個區域正確顯示位置。所以,這個問題似乎沒有格式化,但也許有最大數量的點可以繪製..?
是否可以繪製包含在此處的可重現數據中的所有位置?
任何建議或代碼來繪製上述dat
數據框中的所有點將不勝感激。我很樂意從其他軟件包中提取代碼,如評論中提到的leaflet
。
小冊子可能是一個更好的選擇。 – MLavoie
很酷。傳單看起來也是一個不錯的選擇。話雖如此,現有的代碼與'gvisMap'應該也適用於我的需求,除了OP中的奇怪問題... –