[R-meta] metafor package forest plot query
Viechtbauer, Wolfgang (SP)
wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Sun Mar 10 14:14:57 CET 2019
Hi Martin,
You already got some good suggestions (trying the forestplot and meta packages), but if you want to stick to metafor, you can use:
forest.default()
where the 'col' argument allows you to change the color of the points and CI lines. You then have to use addpoly() to add the summary polygon yourself. For example:
library(metafor)
yi <- c(.2, .5, .8)
vi <- c(.1, .1, .1)
res <- rma(yi, vi)
forest(res)
### this is the same thing
forest(yi, vi, ylim=c(-1.5,6))
abline(h=0)
addpoly(res, row=-1)
### now change colors
forest(yi, vi, ylim=c(-1.5,6), col="blue")
abline(h=0)
addpoly(res, row=-1, col="blue")
Best,
Wolfgang
-----Original Message-----
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On Behalf Of Martin Brown
Sent: Monday, 04 March, 2019 17:26
To: r-sig-meta-analysis using r-project.org
Subject: [R-meta] metafor package forest plot query
Hi All,
I have a small question on forest plots in metafor that hopefully you will be able to help with.
The col option in forest seems to only change the colour of the overall meta-analysis polygon and nothing else.
The main thing I would like to do is change the colour of the points and confidence interval lines too but can't work out how to do it.
I tried doing it using the par function instead but ended up changing the colour of many other things that I didn't want to (like the slab text but the confidence interval lines still stayed black).
I am finding difficult to work out how to change the colour of different parts of the forest plot individually.
If you could point me in the right direction, that would be brilliant.
Thanks!
Martin
Granta Park Great Abington Cambridge CB21 6GQ United Kingdom
tel +44 (0)1223 374 100 fax +44 (0)1223 374 101 www.ppdi.com
PPD Global Ltd. trading as PPD Registered England 1564604 VAT No GB 443 0878 47
More information about the R-sig-meta-analysis
mailing list