【问题标题】:white space in legends while (using breaks argument) plotting rasterLayer with plot() in R图例中的空白,同时(使用中断参数)在 R 中使用 plot() 绘制 rasterLayer
【发布时间】:2021-11-25 13:26:46
【问题描述】:

我正在用plot() 函数绘制一个 RasterLayer。

使用breaks=c(seq(-0.1:0.4,0.45,0.1)) 时。图例的上下区域有空格。如果我不使用休息。图例是自动创建的,没有空格。但是标签不是我想要绘制的。

下面是部分代码:

bb_poly<- readOGR("ne_50m_wgs84_bounding_box.shp")
bb_poly<- spTransform(bb_poly,crs)
bb_poly

pallete <- brewer.pal(7,"YlGn")
lnd<- c(seq(-0.1:0.4,0.45,0.1))

Land_JUNE <- plot(Land_JUNE, breaks=lnd,col= pallete, axes=F, frame.plot=FALSE, box = FALSE, boundary.plot=FALSE, bty="n", legend.args = list(text='Land_JUNE'))
plot(bb_poly, main="IN JUNE",add=T)
plot(coastline ,add=T)

图片链接 Link

【问题讨论】:

    标签: r plot legend whitespace


    【解决方案1】:

    我在 plot 函数中使用了zlim = c(-0.1,0.45,0.1),它创建了一个没有任何空格的好图例。

    Land_JUNE <-
      plot(
       Land_JUNE,
       breaks = lnd,
       col = pallete,
       axes = FALSE,
       frame.plot = FALSE,
       zlim = c(-0.1,0.45,0.1),
       box = FALSE,
       boundary.plot = FALSE,
       bty = "n",
       legend.args = list(text='Land_JUNE')
    )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-07-31
      • 2014-12-02
      • 1970-01-01
      • 2020-05-04
      • 1970-01-01
      • 1970-01-01
      • 2020-01-02
      相关资源
      最近更新 更多