You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用levelplot()绘制Raster时如何移除顶部及右上角直方图

解决levelplot绘制栅格时移除直方图的问题

你看到的顶部及右上角的直方图是levelplot()默认生成的边际图(margin plots),只需在调用函数时添加margin = FALSE参数就能移除它们。

修改后的完整代码如下:

library(raster)
library(rasterVis)

# 定义颜色渐变
colorRamp <- colorRampPalette(c("orange","pink","yellow","green","dark green", "blue","dark blue"))

# 绘制栅格,移除边际直方图
levelplot(r, 
          col.regions = colorRamp(100), 
          main = "Predicted BD", 
          scales = list(draw = FALSE),
          margin = FALSE)  # 新增参数,关闭所有默认边际统计图表

这个参数会直接关闭默认的边际统计可视化,只保留核心的栅格地图内容。

内容的提问来源于stack exchange,提问作者BabakK

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 14:12:05