从forestplot包

时间:2018-05-16 13:47:05

标签: r forestplot

对于论文,我们希望在森林图中显示我们的敏感数据。为此,我使用了R的forestplot-package。对于图,我采用了这里提供的代码:https://www.r-bloggers.com/forest-plot-with-horizontal-bands/。我现在遇到的问题是我的labeltext中的效果是居中对齐的。由于某些影响是否定的,因此文字看起来相当暴躁。虽然我环顾四周但是找不到左对齐文本的方法。

这是实际情节的代码。我认为这是一个小问题,但我得到了股票。 谢谢你的帮助

forestplot(labeltext=tabletext, graph.pos=5, 
       mean=c(NA,NA,NA,NA,data$Group.difference), 
       lower=c(NA,NA,NA,NA,data$Lower), upper=c(NA,NA,NA,NA,data$Upper),
       title="Sensitivity Analyses of gait speed 3 months after Stroke", 
       xlab="<---RELAX Better---                                      ---PHYS Better--->",
       grid = TRUE,
       hrzl_lines=list("5" = gpar(lwd=1, col="black"), 
                       "9" = gpar(lwd=45, lineend="butt", columns=c(1:7), col="#99999922"),
                       "18" = gpar(lwd=45, lineend="butt", columns=c(1:7), col="#99999922"),
                       "26" = gpar(lwd=45, lineend="butt", columns=c(1:7), col="#99999922")),
       txt_gp=fpTxtGp(label=gpar(cex=1.25),
                      ticks=gpar(cex=1.1),
                      xlab=gpar(cex = 1.2),
                      title=gpar(cex = 1.8)),
       col=fpColors(box="black", lines="black", zero = "gray50"),
       zero=0, cex=0.9, lineheight = "auto", boxsize=0.5, colgap=unit(6,"mm"),
       lwd.ci=2, ci.vertices=TRUE, ci.vertices.height = 0.4)

1 个答案:

答案 0 :(得分:0)

只需加入:

 align = c("l", "l", "l"), # Use "l", "c", or "r" for left, center, or right aligned