I have a graph with two results per exposure on the y axis but I want these to appear 'underneath' each other like this plot I can make with ggforestplot https://nightingalehealth.github.io/ggforestplot/index.html
But I want to do this using ggplot2. Here's an example df.
df <- data.frame(
ID = 1:6,
exposure = c('A', 'B', 'C', 'A', 'B', 'C'),
data= c('d', 'd', 'd', 'r', 'r', 'r'),
type= c('b', 'b', 'b', 'c', 'c', 'd'),
cidown = c("0.5", "0.5", "0.6", "0.7", "0.1", "0"),
ciup= c("1", "1.1", "1.2", "2", "2.4", "1"),
p= c("0.9", "0.8", "0", "0.1", "0.2", "0"),
se= c(50000, 60000, 80000, 70000, 45000, 50000),
b= c("0.7", "0.8", "1", "1.5", "1", "0.5")
)
I want to make a forest plot where there are two results for each exposure [as you can see my code below plots my exposures - A,B,C - twice on the same line but I'd like one above the other]
library(ggplot2)
ggplot(df, aes(x = b, y = exposure, xmin = ciup, xmax = cidown))+
geom_point(size=4,aes(shape=data))+
geom_pointrange(shape=1, show.legend = TRUE) +
theme(text=element_text(family="short"))
I do not want them as facets, I already have facet elements.
Thanks