2016-06-09 86 views
0

如何去除光栅图例周围的黑盒?更一般地说,我在哪里可以找到R栅格图例选项的文档?图例选项 - R光栅图例

require(raster) 
     data(volcano) 
     r <- raster(volcano) 
     plot(r, col=topo.colors(100), legend=FALSE, axes=FALSE) 
     r.range <- c(minValue(r), maxValue(r)) 
     plot(r, legend.only=TRUE, col=topo.colors(100), 
      legend.width = 2, 
      axis.args=list(at=seq(r.range[1], r.range[2], 25), 
          labels=seq(r.range[1], r.range[2], 25), 
          cex.axis=0.6), 
      legend.args=list(text='Elevation (m)', side=4, font=2, line=2.5, cex=0.8)) 

回答

1

可以ploting传说之前使用par(bty='n')

par(bty= "n") # remove the box 
plot(r, legend.only=TRUE, col=topo.colors(100), 
    legend.width = 2, 
    axis.args=list(at=seq(r.range[1], r.range[2], 25), 
        labels=seq(r.range[1], r.range[2], 25), 
        cex.axis=0.6), 
    legend.args=list(text='Elevation (m)', side=4, font=2, line=2.5, cex=0.8)) 
par(bty= "o") # set the box 

enter image description here

+0

谢谢!您是否有任何建议来寻找更一般的修补程序?我搜索了剧情光栅传说的文档,显然这个修复与此不同。 – ZAC

+1

通常,特定的'plot()'文档只描述它们的特定部分,因此对于绘制通用选项(不是专用于栅格),必须查看通用'plot()'文档('plot'),然后选择base R ) – HubertL