2017-03-09 3 views
0

VHF受信機の位置のマップをプロットしています。各受信機の位置について、各受信機に取り付けられたアンテナの推定検出範囲(見通し内で12km)を追加したいと思います。ggplotでポイント範囲をプロットするためのgeom_segmentの代替手段

enter image description here しかし、私はより正確にアンテナの検出はなく線分のバルーンと範囲(以下の例のPIC)

表現したい:

私はこの使用注意geom_segmentを行うことができたが、以下に示しますここでMap of Receiver Locations with desired detection ranges

は線分のアプローチを再現するために私の現在のコードです:

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") 

サンプルフィギュアを再作成する方法についてのご意見はありがとうございます。ブライアント

答えて

1

それは少し冗長だが、我々はその形状を作成するために、4 geom_curveを追加することができます

感謝。

最後にcoord_cartesian()geom_curve is not implemented for non-linear coordinatesがありますので、強制的にデカルトにするようにしてください。つまり、この方法は小規模にしか適用できません。

ggmap(map1) + 
    # geom_segment(data = tower, 
    #    aes(x = start, 
    #     y = lat, 
    #     xend = end, 
    #     yend = lat), 
    #    size = 1, colour = "red") + 
    geom_curve(data = tower, 
      aes(x = lon, 
       y = lat, 
       xend = I(lon - .2), 
      curvature = -.5, 
      angle = 45,color = 'yellow') + 
    geom_curve(data = tower, 
      aes(x = lon, 
       y = lat, 
       xend = end, 
       yend = lat), 
      curvature = .5, 
      angle = 135,color = 'yellow') + 
    geom_curve(data = tower, 
      aes(x = lon, 
       y = lat, 
       xend = start, 
       yend = lat), 
      curvature = .5, 
      angle = 135,color = 'yellow') + 
    geom_curve(data = tower, 
      aes(x = lon, 
       y = lat, 
       xend = end, 
       yend = lat), 
      curvature = -.5, 
      angle = 45,color = 'yellow') + 
    geom_point(data = tower, aes(x = lon, y = lat), colour = "black") + 
    coord_cartesian() 

enter image description here

私は、代わりに新しいgeom_*を作成することができたと思います。

+0

問題を解決しましたか? – GGamba

+0

はい、ありがとうございます!これはうまくいくはずです。興味深い解決策。この仕事の一般化のために潜在的に新しい幾何学を作り出す(そしてそれがより大きいスケールで働くために)潜在的に調べる必要がある。 –