I am trying to merge two ggplot2 plots into one based on this table:
Type RatingA RatingB
1 One 3 36
2 Two 5 53
3 One 5 57
4 One 7 74
5 Three 4 38
6 Three 8 83
I want to make two scatter plots with the mean of the ratings in the y axis and type on the x axis.
This is how I create each graph:
p1 <- ggplot(test, aes(x=reorder(Type, RatingA, mean), y=RatingA)) +
stat_summary(fun.y="mean", geom="point")
p2 <- ggplot(test, aes(x=reorder(Type, RatingB, mean), y=RatingB)) +
stat_summary(fun.y="mean", geom="point")
Since p1 and p2 have the same x axis I would like them to be ordered vertically. I looked at facet_align but I couldnt find something that would do the job.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…