0
我正在繪製一個甚高頻接收器位置的地圖。對於每個接收機位置,我想添加連接到每個接收機的天線的估計檢測距離(視距爲12km)。geg_segment替代ggplot中繪製點範圍
我已經能夠做到這一點使用geom_segment如下所示:
但我想更精確地表示該天線檢測與氣球代替線段範圍(下面例子PIC)
這裏是我當前的代碼重現線段的方法:
library(ggmap);library(ggplot2)
tower <- data.frame(id="somewhere", lat = 29.5634, lon = -82.6111)
map1 <- get_map(location = tower[,c("lon","lat")], maptype = "satellite", zoom=9)
tower$start = tower$lon - 0.2 # creates segment length of approx 12km in degrees
tower$end = tower$lon + 0.2 # creates segment length of approx
ggmap(map1) + geom_segment(data=tower, aes(x=tower$start,
y=tower$lat,
xend=tower$end,
yend=tower$lat),
size=1, colour="red") +
geom_point(data=tower, aes(x=lon, y=lat), colour="black")
有關如何重新創建示例圖的任何建議,將不勝感激。
感謝 科比
它解決了你的問題嗎? – GGamba
是的,謝謝!這應該工作。有趣的解決方案。我需要研究可能創造一個新的幾何來推廣這項任務(並且它可以在更大的範圍內工作)。 –