简体   繁体   English

图例选项-R栅格图例

[英]Legend Options - R Raster Legend

How do I remove the black box surrounding the raster legend? 如何删除栅格图例周围的黑框? More generally, where can I find the documentation for the options for R raster legends? 更一般而言,在哪里可以找到有关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))

You can use par(bty='n') before ploting the legend: 您可以在绘制图例之前使用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

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM