Color coding in forest plots?

Hello,
I'm currently conducting a meta-analysis and needing to generate a forest plot summarizing specificity proportions which I was successfully able to do via the meta package in R. However, I now need to color code specific aspects (boxes) of the forest plot and am having difficulty in doing so and was therefore hoping someone might be able to provide some insight or advice?

I have provided the syntax which was used to generate said forest plot, below. For the color-coding, I specifically need distinct color codes for the following boxes of the respective studies (labeled by author name on the far left column within the forest plot):

First color:

  1. Cripps
  2. Hunt
  3. Williams

Second color:

  1. Aniwan
  2. Digby
  3. Kallenberg
  4. Gimeno
  5. Lane
  6. Ng

Third color:
Common effects model - pooled proportion at the bottom of the plot

Fourth color:
Random effects model - pooled proportion at the bottom of the plot

Would someone perhaps know how to go about this, so that there are four distinct color codes within the forest plot as indicated above? Additionally, can a legend / key be added to the forest plot image?

Thank you!!

#setwd("C:/Users/k19027833/OneDrive - King's College London/Annie PhD/Systematic Review/Meta-Analysis")
setwd("C:/Users/k19027833/OneDrive - King's College London/Annie PhD/Systematic Review/Meta-Analysis")
AnnieMA3<-read.csv(file="AnnieMA_specificitypooled.csv")

#Annie MA
##AnnieMA3<-as.matrix(AnnieMA3[,2:3])
##AnnieMA3
#chisq.test(AnnieMA3)
#chisq.test(AnnieMA3)$expected
#set.seed(1066)
#fisher.test(AnnieMA3,simulate.p.value=TRUE)

#install.packages("meta")
library(meta)

#mydata<-read.csv("Pooled Meta analysis_Results_01Aug2023.csv", header=TRUE)
#attach(mydata)
#str(mydata)
names(AnnieMA3)
m1 <- metaprop(controlsb.truenegative.,controlsa.false.positive.+controlsb.truenegative.,studlab=Author,data=AnnieMA3)
#m1 <- metaprop(casesa..true.pos.,casesa..true.pos.+casesb..false.neg.,studlab=Authors,data=AnnieMA3)
m1
forest(m1)

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.