简体   繁体   English

改变森林中正方形的大小 plot R

[英]Changing Size of Squares in forest plot R

I'm new to R and am making some forest plots.我是 R 的新手,正在制作一些森林地块。 I have figured out how to make them using the following code:我已经弄清楚如何使用以下代码制作它们:

library(forestplot)
library(rmeta)

jpeg("test21.jpeg", units = "in", width = 7, height = 7, res = 100)

forestplot(tabletext2, 
        mean = for_forest$median, lower = for_forest$lower, upper = for_forest$upper,
           xlog = FALSE,
        clip = c(-0.006,0.002),
        xticks = c(-0.0006,-0.0004,-0.0002,0,0.0002),
        zero = 0,
           col = fpColors(box = "royalblue",
                          line = "darkblue",
                          summary = "royalblue"))



dev.off()

And I get a decent looking output:我得到了一个不错的 output:

在此处输入图像描述

But how do I make the boxes that represent the median all the same size?但是我如何使代表中位数的盒子大小都一样呢? It seems that more negative medians are smaller boxes while less negative medians are bigger boxes.似乎更多的负中位数是更小的盒子,而更少的负中位数是更大的盒子。 So the magnitude of the median is represented 2 ways, with the position along the line and with its size which is somewhat confusing.所以中位数的大小用两种方式表示,position 沿着这条线,它的大小有点令人困惑。

Also how would I make the lines thicker?另外,我如何使线条变粗?

Thanks!谢谢!

In general you should provide enough data to create a Minimal Reproducible Example we can debug.一般来说,您应该提供足够的数据来创建我们可以调试的最小可重现示例

However, looking at the Package Documentation it says that the boxsize is based on precision, and can be overwritten using the boxsize argument.但是,查看Package 文档,它说 boxsize 是基于精度的,并且可以使用boxsize参数覆盖。 Without sample data to test, I can only give a possible answer, but looking at the examples in the documentation, try adding boxsize = 0.25没有要测试的样本数据,我只能给出一个可能的答案,但是查看文档中的示例,尝试添加boxsize = 0.25

Also there, it says the line widths are set in shapes_gp .同样在那里,它说线宽是在shapes_gp中设置的。 So try adding shapes_gp = fpShapesGp(default = gpar(lwd = 3))所以尝试添加shapes_gp = fpShapesGp(default = gpar(lwd = 3))

forestplot(tabletext2, 
           mean = for_forest$median, lower = for_forest$lower, upper = for_forest$upper,
           xlog = FALSE,
           clip = c(-0.006,0.002),
           xticks = c(-0.0006,-0.0004,-0.0002,0,0.0002),
           zero = 0,
           col = fpColors(box = "royalblue",
                          line = "darkblue",
                          summary = "royalblue"),
           boxsize = 0.25,
           shapes_gp = fpShapesGp(default = gpar(lwd = 3)))

If this doesn't work please send some data for a Minimal Reproducible Example I can debug here.如果这不起作用,请为我可以在此处调试的最小可重现示例发送一些数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM