this is my first question here. Please be nice to a (R-) newbie :)
I'm trying to arrange multiple plots from different data frames, so that they share a common y-axis and the x-axis label/numbers are only displayed under the bottom plot.
My data frames consist of the following columns: measurement time (messzeitpunkt_s), mean (z_mean), upper limit of the confidence interval (z_ci_up), lower limit of the confidence interval (z_ci_low).
This is what I've tried:
- I created the plots I want to stack over another:
`
p_neutral <- ggplot(neutral_all_mean_ci, aes(messzeitpunkt_s, z_mean, colour = " Mittelwert ")) +
theme_bw()+
geom_ribbon(aes(messzeitpunkt_s, ymax = z_ci_up, ymin = z_ci_low), fill = "#FCE5D7", alpha=0.8) +
labs(x = "Messzeit [s]",y = "Neutral")+
geom_line() +
geom_line(aes(y = z_ci_low, colour =" 95% CI ")) +
geom_line(aes(y = z_ci_up, colour = " 95% CI ")) +
theme(legend.position = "none") +
scale_color_manual(values=c("#F7B383", "#3074B3", "#F7B383"))
`
I've used the same code to create the plots p_anger, p_disgust, p_fear, p_happiness, p_sadness, p_surprise, only by replacing the data frame neutral_all_mean_ci in the ggplot-function with anger_all_mean_ci and so on and changing the respective labels.
- When I stack them over another using ggarrage():
ggarrange(p_neutral, p_anger, p_disgust, p_fear, p_happiness, p_sadness, p_surprise, ncol=1)
I end up with this plot.
Now I would like to have a common y-axis scale (so the plots show the same range) and the x-axis label/numbers only at the bottom plot.
Can someone please help me out? Thanks in advance!