knitr: How to show two plots of different sizes next to each other?

前端 未结 4 669
萌比男神i
萌比男神i 2020-12-09 11:28

I wanted to generate two images of different sizes, but show them side-by-side. Is this possible?

This works, but then they have to be the same size:



        
4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-09 12:16

    Another option, if you're outputting to HTML is to use the out.extra= chunk option, and set them to be float objects within a block. For example.

    ```{r fig.width=4, fig.height=6,echo=FALSE,out.extra='style="float:left"'}
    plot(cars)
    ```{r fig.width=8, fig.height=6,echo=FALSE, out.extra='style="float:left"'}
    plot(cars)
    ```
    

提交回复
热议问题