Elio Diaz
Elio Diaz

Reputation: 600

Full width image from file in Tufte with Rmarkdown

I'm starting to use the Tufte package, and I'm trying to plot an image read from a png file in full.width, I tried using the ![caption](image.png) approach, which plots it in the main margin (not full width), also tried reading with imager::load.image(image.png) and plotting within a {r fig.fullwidth = TRUE} call, but it just centers it and leaves for a lot of tweaking to get the figure into full width, besides leaving a lot of space in a page.

Upvotes: 2

Views: 794

Answers (1)

Elio Diaz
Elio Diaz

Reputation: 600

Using include_graphics does the trick:

{r fig-fullwidth, fig.width = 10, fig.height = 2, fig.fullwidth = TRUE, fig.cap = "A full width figure.", warning=FALSE, message=FALSE, cache=TRUE, out.width='100%'}
knitr::include_graphics("agua_sla_fuentes_corte.png")

and it also works for margin figures

Upvotes: 2

Related Questions