I am creating a plot that shows the confidence intervals of two models for each factor. So if my factors are 'A', 'B', 'C', I have six confidence intervals CI1.A, CI2.A, CI1.B, CI2.B, CI1.C, CI2.C. I am using a simple forest plot but want the y-axis labels to be A, B, C, where A is in the middle of CI1.A and CI2.A. How can I rearrange the tick marks to make them appear in the middle of two factors?
Here is a toy example. I have 49 factors so I need a way to be able to read all of the labels.
factors <- c('A1', 'A2', 'B1', 'B2', 'C1', 'C2')
y <- c(1:6)
yhi <- y + .5
ylo <- y - .5
df <- data.frame(factors = factors, y = y, yhi =yhi,
ylo = ylo)
ggplot(df, aes(x=factors, y=y, ymin=ylo, ymax=yhi)) +
geom_linerange() +
coord_flip()
