I\'m using the following code to create three sets of plots in the amazing package ggplot2:
w<-rnorm(100)
x<-rnorm(100)
y<-rnorm(100)
z<-rnorm(10
If you use markdown
, use fig.height
in each code chunk for each plot:
```{r pw, fig.height = 2.66, echo = F}
pw
```
```{r px, fig.height = 2.66, echo = F}
px
```
```{r pz, fig.height = 2.66, echo = F}
pz
```
You'll probably have a better time using grid.arrange()
, from the gridExtra
package:
p1 <- pw + geom_point() + facet_grid(.~g, scales='fixed') + coord_equal() +
stat_smooth(method='lm')
p2 <- px + geom_point() + facet_grid(.~g, scales='fixed') + coord_equal() +
stat_smooth(method='lm')
p3 <- pz + geom_point() + facet_grid(.~g, scales='fixed') + coord_equal() +
stat_smooth(method='lm')
grid.arrange(p1, p2, p3, ncol=1)
You can also use the multiplot() function, which could be customized to suite your needs: http://www.cookbook-r.com/Graphs/Multiple_graphs_on_one_page_(ggplot2)/