Combining forest plot and traffic light plot in meta-analysis using R

1.4k views Asked by At

The software Revman produces a combination of forest plots and traffic light plots in meta-analyses (see e.g. doi: http://dx.doi.org/10.1136/bmjopen-2018-024444, Fig. 3). I am using the package meta fot meta-analysis and robvis for risk of bias. Here is some simple code using example data from the packages:

#creating a forest plot
library(meta)
m <- metacont(n.amlo, mean.amlo, sqrt(var.amlo),
              n.plac, mean.plac, sqrt(var.plac),
              data = amlodipine, studlab = study)
forest(m)

#creating a risk of bias traffic light plot
library(robvis)
rob_traffic_light(data_rob2, tool = "ROB2")

The important thing is that the rows (i.e. each single study) from the forest plot and the rows from the risk of bias plot are aligned. The problem with using packages such as gridExtra is that you have to play around with the alignment and size or the plots until it fits. My question is if there is a good workaround in R to get plots that are similar to the Revman-plots. The result should look like the figure below.enter image description here

1

There are 1 answers

0
Marco Sandri On

Here are some ideas to start building your plot.

library(meta)
data(amlodipine)
m <- metacont(n.amlo, mean.amlo, sqrt(var.amlo),
              n.plac, mean.plac, sqrt(var.plac),
              data = amlodipine, studlab = study)  

library(ggplotify)
p1 <- as.ggplot(~forest(m), scale = 1, hjust = 0, vjust = 0)

library(robvis)
p2 <- rob_traffic_light(data_rob2, tool = "ROB2")

library(patchwork)
graphics.off()
dev.new(width=15,height=6)
wrap_plots(p1, p2, widths=c(9,2), heights=c(15,1))

enter image description here