图例选项 - R光栅图例

时间:2016-06-09 00:38:34

标签: r legend r-raster legend-properties

如何删除光栅图例周围的黑框?更一般地说,我在哪里可以找到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 个答案:

答案 0 :(得分:1)

您可以在绘制图例之前使用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

相关问题