Created
January 21, 2015 08:29
-
-
Save whatalnk/2cc2db62904947ba6147 to your computer and use it in GitHub Desktop.
alline 2 plot , 2 row, ggplot2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Align multiple ggplot2 graphs with a common x axis and different y axes, each with different y-axis labels.](https://gist.github.com/tomhopper/faa24797bb44addeba79) | |
`grid.draw()` is from grid package | |
* same x axis | |
* y values are different, so margin of y axis is different | |
* in result, width of plot area are changed | |
```{r} | |
gp1 <- ggplot(...) | |
gp2 <- ggplot(...) | |
grid.draw(rbind(ggplotGrob(gp1), ggplotGrob(gp2), size = "last")) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment