使用 knitr 在 rmarkdown 中并排显示两个图像?
Two images side by side in rmarkdown using knitr?
在 Rmarkdown 中,我想并排打印来自网络的两张图片。我正在尝试这个
```{r, echo=FALSE, out.width="33%", fig.align = "center", fig.cap="Examples of the FPTP bias: In Prairies (left) and Greater Toronto area (right). Source: www.fairvote.ca"}
knitr::include_graphics(
c("https://www.fairvote.ca/wp-content/uploads/2019/12/Western-alienation-website-FPTP-page.png", "https://www.fairvote.ca/wp-content/uploads/2019/12/Toronto-Peel-halton-2019-results-website-FPTP.jpg")
)
```
但我得到的是这个 - 它们仍然打印在另一个上面:
请指教。注意:我不知道要使用什么 cowplot
或任何其他包。
包括参数 fig.show='hold'
。
```{r, echo=FALSE, out.width="33%", fig.align = "center", fig.show='hold', fig.cap="Examples of the FPTP bias: In Prairies (left) and Greater Toronto area (right). Source: www.fairvote.ca"}
knitr::include_graphics(
c("https://www.fairvote.ca/wp-content/uploads/2019/12/Western-alienation-website-FPTP-page.png",
"https://www.fairvote.ca/wp-content/uploads/2019/12/Toronto-Peel-halton-2019-results-website-FPTP.jpg")
)
```
这是现在的样子:
在 Rmarkdown 中,我想并排打印来自网络的两张图片。我正在尝试这个
```{r, echo=FALSE, out.width="33%", fig.align = "center", fig.cap="Examples of the FPTP bias: In Prairies (left) and Greater Toronto area (right). Source: www.fairvote.ca"}
knitr::include_graphics(
c("https://www.fairvote.ca/wp-content/uploads/2019/12/Western-alienation-website-FPTP-page.png", "https://www.fairvote.ca/wp-content/uploads/2019/12/Toronto-Peel-halton-2019-results-website-FPTP.jpg")
)
```
但我得到的是这个 - 它们仍然打印在另一个上面:
请指教。注意:我不知道要使用什么 cowplot
或任何其他包。
包括参数 fig.show='hold'
。
```{r, echo=FALSE, out.width="33%", fig.align = "center", fig.show='hold', fig.cap="Examples of the FPTP bias: In Prairies (left) and Greater Toronto area (right). Source: www.fairvote.ca"}
knitr::include_graphics(
c("https://www.fairvote.ca/wp-content/uploads/2019/12/Western-alienation-website-FPTP-page.png",
"https://www.fairvote.ca/wp-content/uploads/2019/12/Toronto-Peel-halton-2019-results-website-FPTP.jpg")
)
```
这是现在的样子: