1

我正在使用 forestplot 包在 r 中制作森林图(请参阅https://cran.r-project.org/web/packages/forestplot/forestplot.pdf)。

我对情节的外观感到满意,但问题是分辨率不够高。我尝试了各种方法来增加绘图的大小,但无论我做什么,总绘图区域始终保持不变(即使我可以更改文本的大小等)。

我包括几个数字来说明我的观点。第二个简单地通过将 tiff 函数的宽度和高度参数设置为第一个图形的两倍来创建。通常,这会导致绘图在整个区域上拉伸,但这里似乎并非如此,而是第二张图像仅获得宽的白色边距。

在此处输入图像描述

第二个: 在此处输入图像描述

代码如下:

library(rmeta)
 tiff("/mypath", width=480*multifactor, height = 480*multifactor)

forestplot(tabletext,m,l,u,zero=0,is.summary=c(TRUE,FALSE,TRUE,rep(FALSE,(nrow(input)+1)),TRUE,TRUE,TRUE),clip=c(log(0.5),log(32)), xlog=TRUE,xlab="RR",xticks=c(0.5,1,2,4,8,16,32),col=meta.colors(box="royalblue",line="darkblue", summary="royalblue"))

dev.off()   

这是(有点混乱)可重现的例子:

tabletext <-
structure(c("mock test", NA, "Site", "A", "B", "C", "D", "E", 
"F", "G", "H", "I", "J", "K", NA, NA, "All", "  ", "  ", "  ", 
"  ", "  ", "  ", "  ", "  ", "  ", "  ", "  ", "  ", "  ", "  ", 
"  ", "  ", "  ", NA, NA, "Aff", "37", "140", "114", "34", "185", 
"184", "26", "161", "90", "106", "191", NA, "RR", "1.61", NA, 
NA, "Ctrl", "48", "152", "36", "80", "168", "191", "44", "86", 
"15", "127", "74", NA, NA, NA, NA, NA, "RR", "7", "3", "4", "5", 
"3", "4", "8", "2", "2", "3", "7", NA, NA, NA, "  ", "  ", "  ", 
"  ", "  ", "  ", "  ", "  ", "  ", "  ", "  ", "  ", "  ", "  ", 
"  ", "CI95%", "(1.31-1.97)", NA, NA, "P", "0.1", "0.1", "0.1", 
"0.1", "0.1", "0.1", "0.1", "0.1", "0.1", "0.1", "0.1", NA, "P", 
"0.02", "  ", "  ", "  ", "  ", "  ", "  ", "  ", "  ", "  ", 
"  ", "  ", "  ", "  ", "  ", "  ", "  ", "  "), .Dim = c(17L, 
8L), .Dimnames = list(NULL, c("plot_col1", "plot_col2", "plot_col3", 
"plot_col4", "plot_col5", "plot_col6", "plot_col7", "plot_col8"
)))

m <-
c(NA, NA, NA, 2.07944154167984, 1.6094379124341, 1.79175946922805, 
1.94591014905531, 1.09861228866811, 1.79175946922805, 1.09861228866811, 
2.07944154167984, 1.38629436111989, 0.693147180559945, 1.09861228866811, 
NA, NA, 0.476234178996372)

l <-
c(NA, NA, NA, 1.79175946922805, 1.6094379124341, 1.79175946922805, 
0.693147180559945, 1.09861228866811, 1.6094379124341, -Inf, -Inf, 
1.38629436111989, 1.79175946922805, 0, NA, NA, 0.27002713721306
)

u <-
c(NA, NA, NA, 2.19722457733622, 2.19722457733622, 2.30258509299405, 
2.07944154167984, 2.07944154167984, 2.19722457733622, 2.30258509299405, 
2.07944154167984, 1.6094379124341, 2.30258509299405, 1.94591014905531, 
NA, NA, 0.678033542749897)

谢谢您的帮助。

4

1 回答 1

0

我无法重现您的示例,但您是否尝试包含'res'

tiff("test.tiff", width=480*multifactor, height = 480*multifactor, res=300)
forestplot(...)
dev.off()
于 2018-08-20T00:58:03.807 回答