With the help of some kind individuals, I was able to transform the proportions in my forest plot to percentages through the metafor package.
I believe I have one issue left with my forest plot, and that's the width. As you can see in photo, the plot of the data in the middle is just WAY too wide; it's taking up 2/3 of the picture's space.
--- How can I narrow this plot, and at the same time reduce the amount of gap there is between the text columns (e.g., "Study", "Events", Total") and the plot?
Please disregard the blue boxes; I'm just blurring out the data because it's not relevant here. Essentially, what you can see is that I have three columns on the left: Study, Events and Total, and two columns on the right: Weight and % [95% CI]
Here's the code I have so far
forest(dat.back$yi, ci.lb=dat.back$ci.lb, ci.ub=dat.back$ci.ub, psize=1, xlab = "CNCP Prevalence (%)", slab = Study.Name, atransf = mytransf, xlim = c(-0.35,1.05), ylim = c(-1.5,16), header = c("Study", "Weight % [95% CI]"), refline = 0.399, digits = 1, ilab = cbind(dat.back$xi, dat.back$ni, dat.back$wt), ilab.xpos = c(-0.15, -0.05, 0.88), at = c(0.10, 0.40, 0.70))
text(c(-0.15, -0.05), 15, c("Events", "Total"), font= 2)
text(c(-0.15, -0.05), -0.5, c("108293", "224624"), font = 1)
text(c(0.88), -0.5, c("100%"), font = 1)
addpoly(pred$pred, ci.lb=pred$ci.lb, ci.ub=pred$ci.ub, row=-0.5, digits=1, mlab="Total (RE Model)", efac=1.5, atransf = mytransf, cex = 1.00)
text(-0.35, -1.5, pos = 4, cex = 1.00, bquote(paste(tau^2, " = ", .(formatC(res$tau2, digits = 2, format = "f")), " , ", I^2, " = ", .(formatC(res$I2, digits = 2, format = "f")), " , ", chi^2, " = ", .(formatC(res$QE, digits = 1, format = "f")), " , ", p, " = ", .(formatC(res$QEp, digits=4, format="f")))))
Here's what I get when I use str() for my forest plot:
List of 8
$ xlim : num [1:2] -0.35 1.05
$ alim : num [1:2] 0.1 0.7
$ at : num [1:7] 0.1 0.2 0.3 0.4 0.5 0.6 0.7
$ ylim : num [1:2] -3 17
$ rows : int [1:13] 1 2 3 4 5 6 7 8 9 10 ...
$ cex : num 1
$ cex.lab : num 1
$ cex.axis: num 1
Would greatly appreciate the help. Thank you!!
You have the
plotwidth
argument that will reduce the forest plot with for exemple :plotwidth=unit(10, "mm")
. Also, add thecolgap
(you can adjust the number to fit what you want) :