emudrak
emudrak

Reputation: 1016

How to change dimensions of metafile figure output in Rmarkdown?

I have a client who would like to use Rmarkdown to make figures into a Word Document and then edit them (I know... not really the point of reproducible research, but it's what the client wants...)

 ----
 title: "MinReproEx_Metafile" 
 author: "Erika Mudrak" 
 date: "Thursday, July 17, 2014" 
 output: word_document
 ----

 Try to put a bigger metafile figure in a work document 

 ```{r, echo=FALSE, dev='win.metafile', fig.height=6, fig.width=6}
 plot(cars) 
 ```

Using dev='win.metafile' places the figure as an editable metafile, but regardless of the input for fig.height and fig.width the figure is 1.67 x 1.67 inches. So somehow the dev='win.metafile' overrides these chunk options.

The knitr option page has this about dev.args:

dev.args: (NULL) more arguments to be passed to the device, e.g. dev.args=list(bg='yellow', pointsize=10); note this depends on the specific device (see the device documentation); when dev has multiple elements, dev.args can be a list of lists of arguments with each list of arguments to be passed to each single device, e.g. <>=

Where can I find the device documentation for the metafile format to which this refers?

Upvotes: 3

Views: 730

Answers (1)

Daijiang Li
Daijiang Li

Reputation: 697

Try out.height=6, out.width=6. (try different numbers) If still does not work, just tell them copy the figures from the figure/ file folder (usually in the same directory as your Rproj) and then paste in their doc files. Knitr saves all figures in your computer if cache=TRUE.

Upvotes: 0

Related Questions