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.

8
  • Please provide a reproducible example, including data. Commented Dec 28, 2017 at 20:33
  • Can I upload my data sheet in here? Commented Dec 28, 2017 at 20:36
  • I suggest you read the various answers to this question: stackoverflow.com/questions/5963269/… Commented Dec 28, 2017 at 20:39
  • Possible duplicates: Add table of values below ggplot, How can I add a table to ggplot output?. Commented Dec 28, 2017 at 20:41
  • 1
    Thanks - sure. Im new in here. Im deleting this post and I will do a new one. Commented Dec 28, 2017 at 20:42

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.