18

Rパッケージ「raster」の図の枠を外したいのですが、どの引数を変更すればよいのかわかりません。例は次のとおりです。

library(raster)

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

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

plot(r)

plot(r,axes=F)
4

2 に答える 2

37

これは機能します:

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

自分でそれを見つける方法を知るには、以下を試して、基礎となる関数を見てください。(ラスターパッケージは、より一般的に使用される S3 メソッドではなく、S4 メソッドを広範囲に使用するため、showMethods()との呼び出しgetMethod()が必要です。)

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, ...) 
于 2013-01-22T23:39:37.443 に答える
0

私が提案できる最高のものは

plot(r,axes=F,useRaster=F)

このオプションbty='n'は通常、ボックスを取り除きますが、ラスター プロット関数は、取り除くことができない通常のボックスの上に独自のボックスを描画しているようです。

于 2013-01-22T23:28:39.320 に答える