如何删除R包"raster"中"plot.raster"中的框架

Jia*_*ang 15 plot r raster spatial

我需要删除R包"raster"中图形周围的框框,但我无法弄清楚应该更改哪个参数.示例如下:

library(raster)

r <- raster(nrows=10, ncols=10)

r <- setValues(r, 1:ncell(r))

plot(r)

plot(r,axes=F)
Run Code Online (Sandbox Code Playgroud)

Jos*_*ien 30

这有效:

plot(r, axes=FALSE, box=FALSE)
Run Code Online (Sandbox Code Playgroud)

要了解如何为自己找到答案,请通过尝试以下方法查看基础函数.(调用showMethods()getMethod()需要因为栅格包广泛使用S4方法而不是更常用的S3方法.)

showMethods("plot")
getMethod("plot", c("Raster", "ANY"))
getAnywhere(".plotraster2")
getAnywhere(".rasterImagePlot")
args(raster:::.rasterImagePlot)
# function (x, col, add = FALSE, legend = TRUE, horizontal = FALSE, 
#     legend.shrink = 0.5, legend.width = 0.6, legend.mar = ifelse(horizontal, 
#         3.1, 5.1), legend.lab = NULL, graphics.reset = FALSE, 
#     bigplot = NULL, smallplot = NULL, legend.only = FALSE, lab.breaks = NULL, 
#     axis.args = NULL, legend.args = NULL, interpolate = FALSE, 
#     box = TRUE, breaks = NULL, zlim = NULL, zlimcol = NULL, fun = NULL, 
#     asp, colNA = NA, ...) 
Run Code Online (Sandbox Code Playgroud)