本文介绍了如何删除"plot.raster"中的框框?在R包"raster"中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I need to remove the box frame around the figure in R package "raster", but I cannot figure out which argument I should change. The example is as follows:

library(raster)

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

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

plot(r)

plot(r,axes=F)

推荐答案

这有效:

plot(r, axes=FALSE, box=FALSE)

要了解如何自己找到答案,请尝试以下操作,以了解基础功能. (需要调用showMethods()getMethod(),因为 raster 软件包广泛使用了S4方法,而不是更常用的S3方法.)

To learn how you could have found that out for yourself, have a look at the underlying functions by trying the following. (The calls to showMethods() and getMethod() are needed because the raster package makes extensive use of S4 methods rather than the more commonly used S3 methods.)

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, ...)

这篇关于如何删除"plot.raster"中的框框?在R包"raster"中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 16:04