1

Can you help with adding a side table to a Forest Plot I have made in ggplot2?

I tried Google but that didn't solve my problem.

My variables are

datasheet = d
d$author = name of the study
d$number = study size (number of patients)
d$treat = number of treatments
d$hr_l = lower CI
d$hr_u = upper CI

I wrote

fp <- ggplot(data=d, aes(x=author, y=treat, ymin=d$hr_l, ymax=d$hr_u))+
      geom_linerange(size=8, colour="#222a37", alpha=0.4) +
      geom_hline(aes(yintercept=4.27), lty=2, colour="black") +
      geom_point(size=3, shape=21, fill="darkred", alpha=0.4, 
      colour = "darkred", stroke = 1) +
      scale_y_continuous(limits = c(1, 7), breaks=breaks, 
      labels=labels, name = "Number of treatments") +
      scale_x_discrete(name="") + coord_flip() +
      ggtitle("Name") +
      theme_gray() 

print(fp)

Which prints:

Forest plot I want to add a side table where the study size (d$number) is shown next to the study name (d$author).

There is a similar example here: enter image description here

But instead of "Occupation", "Recreation", "Gender" and "OR", I want d$author and d$number shown.

Spacedman
  • 92,590
  • 12
  • 140
  • 224
cmirian
  • 2,572
  • 3
  • 19
  • 59

0 Answers0