4

I'm new to knitr, rmarkdown and pandoc, and am having trouble figuring out where to set options.

I'd like to have a figure with a width wider than 6 inches. Even in a default word doc margins, it seems like there is at least 6.5 inches available, and there's even more if I am willing to reduce the margins.

However, when I try to set fig.width in a chunk that creates a word doc, graphs are never more than 6 inches wide. Instead it just changes the aspect ratio.

Is there an option somewhere that is overriding fig.width? Can I change it in the reference docx?

Here's an example .rmd.

---
title: "Graph Size Test"
output: word_document
---

# Test 1 

Looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong string
```{r, echo = FALSE, fig.width = 6, fig.height = 5}

df <- data.frame(x = c(1, 2, 3), y = c(1, 10, 3))
plot(df$x, df$y)

```


## Test 2

Looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong string
```{r, echo = FALSE, fig.width = 6.5, fig.height = 5}
plot(df$y, df$x)
```

## Test 3

Still only 6 inches wide, just now much shorter.
```{r, echo = FALSE, fig.width = 10, fig.height = 5}
plot(df$y, df$x)
```

Edit:

To make matters worse, my graphs are being set to be 6 inches wide even when the document is in landscape orientation. How can I make them larger?

GregF
  • 1,292
  • 11
  • 14
  • The images are scaled down to fit into 6 inches. When I right click on figure 3 and click "Size and Position", it says it's 59% width and 59% height. – TJ Mahr Aug 08 '15 at 02:26
  • See also https://stackoverflow.com/questions/14829791/figure-sizes-with-pandoc-conversion-from-markdown-to-docx – TJ Mahr Aug 08 '15 at 02:26
  • @TJMahr, thanks. You don't happen to know how to stop it from doing this, do you? Or at least have the width scaled to some size bigger than 6 inches? – GregF Aug 10 '15 at 14:09

0 Answers0