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

移除forestploter包中森林图的置信区间箭头

使用forestploter包绘制森林图时移除置信区间箭头的问题

我正在使用{forestploter}包绘制森林图。在以下示例中,第二行(var = "b")的置信区间下限(0.4)低于我设定的x轴下限(0.5),此时forest()函数会自动绘制箭头。

library(forestploter)

df <- data.frame(var = c("a", "b", "c"),
                 CI = paste(rep(" ", 20), collapse = ""),
                 est = c(0.9, 0.7, 1.0),
                 lower = c(0.6, 0.4, 0.7),
                 upper = c(1.1, 0.9, 1.2))

forest(df[, 1:2],
       est = df$est,
       lower = df$lower, 
       upper = df$upper,
       ci_column = 2,
       ref_line = 1,
       x_trans = "log",
       arrow_lab = c("Placebo Better", "Treatment Better"),
       xlim = c(0.5, 2),
       ticks_at = c(0.5, 1, 2),
       theme = forest_theme(base_size = 9,
                            ci_Theight = 0.25))

森林图示例

我希望移除该箭头,将区间左端保留为水平线。

我尝试的方法是在forest_theme()中设置arrow_length = 0:

theme = forest_theme(base_size = 9,
                     ci_Theight = 0.25,
                     arrow_length = 0)

但该设置仅隐藏了x轴下方的箭头,而非置信区间上的箭头。

设置arrow_length=0后的森林图

请问如何修改此行为?

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.11 15:04:57