r - Control alignment of two side-by-side plots in knitr -
i cannot figure out how arrange 2 side-by-side plots explained in knitr graphics manual page 2 (http://yihui.name/knitr/demo/graphics/). use following mwe , output below. them aligned shown in manual 2 cars plots (also on page 2 of manual). pdf generated in rstudio (knit pdf).
--- title: "untitled" output: pdf_document --- ## r markdown ```{r,echo=false,out.width='.49\\linewidth', fig.width=3, fig.height=3} barplot(1:4) barplot(4:7) ```
to center 2 plots can add fig.align='center'
to chunk options. if produces 1 plot above other add fig.show='hold'
. result should 2 centered graphs.
so final chunk option should like:
{r,echo=false, out.width='.49\\linewidth', fig.width=3, fig.height=3,fig.show='hold',fig.align='center'}
Comments
Post a Comment