我正在尝试将数据绘制到具有对数转换的连续 x 轴的图形上。我的代码如下:
(森林图的样本数据)
tabletext <- cbind(c("Analysis","combined","A","B"),
c("Observational","0.92 [0.87,0.96]","0.94 [0.89,1.01]","0.88 [0.82,0.95]"),
c("MR","0.95 [0.92,0.98]","0.96 [0.92,1.00]","0.87 [0.78,0.97]"))
mean_mr <- c(NA,0.95,0.96,0.84)
mean_obs <- c(NA,0.92,0.94,0.85)
lower_mr <- c(NA,0.92,0.92,0.78)
lower_obs <- c(NA,0.87,0.89,0.82)
upper_mr <- c(NA, 0.98,1.00,0.97)
upper_obs <- c(NA,0.96,1.10,0.94)
mean <- cbind(mean_obs,mean_mr)
lower <- cbind(lower_obs,lower_mr)
upper <- cbind(upper_obs,upper_mr)
生成森林图:
library(forestplot)
forestplot(tabletext,mean,lower,upper,is.summary=c(TRUE,rep(FALSE,3)),
boxsize=0.2,hrzl_lines=gpar(lwd=1,columns=1:4),xlog=1,
col=fpColors(box=c("black"),line=c("black")),
txt_gp = fpTxtGp(label = gpar(fontfamily = "",cex=1.1),
ticks=gpar(fontfamily="",cex=0.8),xlab = gpar(fontfamily = "", cex = 1.1)))
我尝试使用 xlim 指定 x 轴限制,但这对绘图没有影响,并且 xticks 似乎覆盖了 xlog 参数。我还注意到,即使我删除了 xlog 参数,我也无法指定 x 轴限制。有什么方法可以在森林图中的(对数转换)比例上指定 x 轴限制?