Knitr: Increase size of pdf graphic


#1

I have a pdf graphic that I want to include in a knitr document. As inserted it is about half the size that I would like it to be. Is there a way to tell include_graphics() to print it larger?


#2

The out.width arg will let you control the size

```{r, out.width = "150%", echo = FALSE, fig.align = "center"}
knitr::include_graphics(xxx)
```

#3

Thanks, RuReady. I had tried that, and it should have worked. But I made my graphic by exporting an Excel spreadsheet as a .pdf file. Despite my telling Excel that I wanted only my selected cells to be exported, Excel exported an entire page to the .pdf file, with the spreadsheet selection in the upper left hand corner. So when knitr tried to import it, I guess it found a page size file and couldn't change the dimensions of the actual graphic. I eventually found a way within Excel to export the table at 1.5 size the normal size, and this worked fine.
In sum, my problem was not a problem with knitr, which works beautifully, but rather with Excel, that seems to have a mindless conviction that when one exports a table to a .pdf file, it should be included on a full page of paper. Another example of MS's tendency to think that they know better than we what we are trying to do.