giordano
giordano

Reputation: 3152

Rstudio/markdown/Word: no size options for tiff figures?

I'm using RStudio/markdown and want to produce a Word-document. I have a tiff-graphic which I want to include in the document. Since the figure appears quite small in the Word-document I want to resize it:

```{r , fig.align="center", echo=FALSE, out.width = "600px"}
knitr::include_graphics("./03_figures/graph.tiff")
```

But this gives the following output:

Output created: test.docx
Warnmeldungen:
1: In hook_plot(x[i], reduce_plot_opts(options)) :
  Chunk options fig.align, out.width, out.height, out.extra are not supported       
  for Word output

I tried also other options: fig.width = 1, fig.height=2 which gives me similar warnings.

I wonder how can I change the size of a tiff-figure using parameters.

The size options works if I use html output and png-file. Tiff-files couldn't be loaded by the html (but this is another issue).

Upvotes: 2

Views: 1276

Answers (1)

Martin Schmelzer
Martin Schmelzer

Reputation: 23899

A work around is to read in the file using the tiff package and plot it using grid:

```{r, fig.width = 1}
library(tiff)
library(grid)
grid.raster(readTIFF("./03_figures/graph.tiff"))
```

Upvotes: 4

Related Questions