3

RのパッケージRgoogleMapsを使用しています。マップをプロットしました。pointsコマンドでポイントを追加する必要がありますが、機能しません。これが私のコードです:

PlotOnStaticMap(Map, add = FALSE, TrueProj=F,  FUN = points)    # plot the background

# add external boundary

for (nb in 1:100)
{
    points(x[nb],y[nb],type="l",lwd=3)
}

どうすれば修正できますか?

4

1 に答える 1

4

これがあなたが探しているものだと思います:

lat = c(40.702147,40.718217,40.711614);
lon = c(-74.012318,-74.015794,-73.998284);
center = c(mean(lat), mean(lon));
zoom <- min(MaxZoom(range(lat), range(lon)));


Map <- GetMap(center=center, zoom=zoom,markers = paste0("&markers=color:blue|label:S|",                                                      
                                                          "40.702147,-74.015794&markers=color:green|label:G|40.711614,-74.012318&markers=",
                                                          "color:red|color:red|label:C|40.718217,-73.998284"), destfile = "MyTile1.png");





tmp <- PlotOnStaticMap(Map, lat = c(40.702147,40.711614,40.718217), 
                       lon = c(-74.015794,-74.012318,-73.998284), 
                       destfile = "MyTile1.png", cex=1.5,pch=20,                       
                       col=c('red', 'blue', 'green'), add=FALSE);


# Now let's add points with the points method:

PlotOnStaticMap(Map, lat = c(40.702147,40.711614,40.718217), 
                lon = c(-74.015794,-74.012318,-73.998284), 
                lwd=1.5,col=c('red', 'blue', 'green'),  points(x = 40.702148, y = NULL ), add=TRUE)

points()within PlotOnStaticMap?の構文を参照してください。

于 2014-12-08T14:57:52.883 に答える