小编Per*_*rro的帖子

R中箱线图后面的网格

boxplot如果我grid在绘图前面使用网格,我想向我的 中添加一个网格。我怎样才能把这个网格放在后面?

在此输入图像描述

我正在使用的代码如下

library(dplyr)
input <- mtcars[,c('mpg','cyl')]
print(head(input))
boxplot(mpg ~ cyl, data = mtcars, xlab = "Number of Cylinders",
        ylab = "Miles Per Gallon")
grid(nx=16, ny=16)
Run Code Online (Sandbox Code Playgroud)

grid plot r

5
推荐指数
1
解决办法
4494
查看次数

在shapefile中创建网格

我正在尝试在shapefile中创建一个网格,诸如此类。但是,我无法生成这样的网格。我想知道是否有人对如何实现这一目标有想法。

这是我的代码-

WWWL.Shape<- readOGR("E:/Juan Arango", "WWL_Commerce_OK")
WWWL.Shape
plot(WWWL.Shape)
proj4string(WWWL.Shape)

bb <- bbox(WWWL.Shape)
cs <- c(3.28084, 3.28084)*6000  # cell size 
cc <- bb[, 1] + (cs/2)  # cell offset
cd <- ceiling(diff(t(bb))/cs)  # number of cells per direction
grd <- GridTopology(cellcentre.offset=cc, cellsize=cs, cells.dim=cd)
grd
sp_grd <- SpatialGridDataFrame(grd,
                               data=data.frame(id=1:prod(cd)),
                               proj4string=CRS(proj4string(WWWL.Shape)))
plot(sp_grd)
Run Code Online (Sandbox Code Playgroud)

输出 WWL.Shape

class       : SpatialPolygonsDataFrame 
features    : 1 
extent      : 334367, 334498.7, 4088915, 4089057  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=utm +zone=15 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0 
variables   : 1 …
Run Code Online (Sandbox Code Playgroud)

r geospatial shapefile

1
推荐指数
1
解决办法
2067
查看次数

标签 统计

r ×2

geospatial ×1

grid ×1

plot ×1

shapefile ×1