我从25公里网格的点shapefile中得到了一系列的经度
lon <- c(-53.615449969, -53.365449969, -53.115449969, -53.365449969,
-53.115449969, -52.865449969, -53.365449969, -53.115449969, -52.865449969,
-52.615449969, -53.365449969, -53.115449969, -52.865449969, -52.615449969,
-52.365449969, -53.365449969, -53.115449969, -52.865449969, -52.615449969,
-52.365449969, -53.615449969, -53.365449969, -53.115449969, -52.865449969,
-52.615449969, -52.365449969, -52.115449969, -53.865449969, -53.615449969,
-53.365449969, -53.115449969, -52.865449969, -52.615449969, -52.365449969,
-52.115449969, -51.865449969, -54.365449969, -54.115449969, -53.865449969,
-53.615449969, -53.365449969, -53.115449969, -52.865449969, -52.615449969,
-52.365449969, -52.115449969, -51.865449969, -51.615449969, -54.615449969,
-54.365449969, -54.115449969, -53.865449969, -53.615449969, -53.365449969,
-53.115449969, -52.865449969, -52.615449969, -52.365449969, -52.115449969,
-51.615449969)
lat <- c(-33.627081271, -33.627081271, -33.627081271, -33.377081271,
-33.377081271, -33.377081271, -33.127081271, -33.127081271, -33.127081271,
-33.127081271, -32.877081271, -32.877081271, -32.877081271, -32.877081271,
-32.877081271, -32.627081271, -32.627081271, -32.627081271, -32.627081271,
-32.627081271, -32.377081271, -32.377081271, -32.377081271, -32.377081271,
-32.377081271, -32.377081271, -32.377081271, -32.127081271, -32.127081271,
-32.127081271, -32.127081271, -32.127081271, -32.127081271, -32.127081271,
-32.127081271, -32.127081271, -31.877081271, -31.877081271, -31.877081271,
-31.877081271, -31.877081271, -31.877081271, -31.877081271, -31.877081271,
-31.877081271, -31.877081271, -31.877081271, -31.877081271, -31.627081271,
-31.627081271, -31.627081271, -31.627081271, -31.627081271, -31.627081271,
-31.627081271, -31.627081271, -31.627081271, -31.627081271, -31.627081271,
-31.627081271)
df <- as.data.frame(cbind(lon, lat))
df$ID <- 1:nrow(df)
coordinates(df) <- c(1,2)
plot(df, pch = 0)
为什么正方形不互相接触?我想如果这是一个25公里的网格,那么所有正方形都应该共享各自的边界。
答案 0 :(得分:1)
您创建的是一个SpatialPointsDataFrame-plot
时,您得到的标记位于这些点的中心。使用pch=0
使用方形标记,但是它不知道数据是规则的网格。您可以绘制具有不同大小的标记-尝试:
plot(df, pch = 0, cex=6)
plot(df, pch = 0, cex=0.5)
或使用其他标记:
plot(df, pch="Z")