简体   繁体   中英

Two images side by side in rmarkdown using knitr?

In Rmarkdown I want to print two images from the web side by side. I'm trying this

```{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")
  )

```

But instead I'm getting this - they are still printed one on top of the other:

在此处输入图片说明

Please advise. Note: I dont what to use cowplot or any other package.

Include the argument 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")
)
```

Here is what it looks like now: 这是它现在的样子。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM