Skip to content

Instantly share code, notes, and snippets.

@cderv cderv/manual-test.Rmd
Last active Nov 23, 2019

Embed
What would you like to do?
Test for knitr issue on include_graphics (https://github.com/yihui/knitr/pull/1776)
# one graphic
```{r, fig.cap = "This is a caption for unique figure"}
knitr::include_graphics("test-1.png")
```
# Three graphics in the same chunk
Using three times `include_graphics`
```{r, fig.cap = "This is a caption", out.width = "33%", fig.show = "hold"}
knitr::include_graphics("test-1.png")
knitr::include_graphics("test-2.png")
knitr::include_graphics("test-3.png")
```
```{r, fig.cap = "This is another caption", out.width = "33%", fig.show = "hold"}
knitr::include_graphics(c("test-1.png", "test-2.png", "test-3.png"))
```
# mixing with plot
```{r, fig.cap = "This is a caption", out.width = "33%", fig.show = "hold"}
knitr::include_graphics("test-1.png")
plot(iris)
knitr::include_graphics("test-2.png")
1+1
knitr::include_graphics("test-3.png")
```
```{r, fig.cap = c("This is a caption", "This is another", "this is a plot", "And a last"), out.width = "33%"}
knitr::include_graphics(c("test-1.png", "test-2.png"))
plot(iris)
1+1
knitr::include_graphics("test-3.png")
```
# Placing on top
```{r, fig.cap = "This is a caption", out.width = "33%", fig.show = "hold", fig.topcaption = TRUE}
knitr::include_graphics("test-1.png")
knitr::include_graphics("test-2.png")
knitr::include_graphics("test-3.png")
```
```{r, fig.cap = "This is another caption", out.width = "33%", fig.show = "hold", fig.topcaption = TRUE}
knitr::include_graphics(c("test-1.png", "test-2.png", "test-3.png"))
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.