gridextra

Add a common Legend for combined ggplots

*爱你&永不变心* 提交于 2019-11-26 00:57:16
问题 I have two ggplots which I align horizontally with grid.arrange . I have looked through a lot of forum posts, but everything I try seem to be commands that are now updated and named something else. My data looks like this; # Data plot 1 axis1 axis2 group1 -0.212201 0.358867 group2 -0.279756 -0.126194 group3 0.186860 -0.203273 group4 0.417117 -0.002592 group1 -0.212201 0.358867 group2 -0.279756 -0.126194 group3 0.186860 -0.203273 group4 0.186860 -0.203273 # Data plot 2 axis1 axis2 group1 0

Left align two graph edges (ggplot)

别来无恙 提交于 2019-11-25 22:25:07
问题 I\'m using ggplot and have two graphs that I want to display on top of each other. I used grid.arrange from gridExtra to stack them. The problem is I want the left edges of the graphs to align as well as the right edges regardless of axis labels. (the problem arises because the labels of one graph are short while the other is long). The Question: How can I do this? I am not married to grid.arrange but the ggplot2 is a must. What I\'ve tried: I tried playing with widths and heights as well as