2
我想摆脱SpatialPolygons绘图的顶部和底部边距。 我曾尝试将边距设置为c(0,0,0,0),但这只会改变左右边距。删除PNG绘图边距
在RStudio中绘图时,顶部和底部边距为0,但左侧和右侧不是。
library(sp)
coords <- cbind(c(631145, 631757, 631928, 631664, 631579, 631281),
c(6967640, 6967566, 6968027, 6967985, 6968141, 6968009))
poly <- Polygons(list(Polygon(coords)),"coords")
poly.sp <- SpatialPolygons(list(poly))
par(mar = rep(0, 4), xaxs='i', yaxs='i')
plot(poly.sp, bg="yellow")
png('poly.png')
par(mar = rep(0, 4), xaxs='i', yaxs='i')
plot(poly.sp, bg="yellow")
dev.off()
很棒的工作! – Andy