Prradep
Prradep

Reputation: 5716

maximum accepted value for fig.width knitr option

What is the maximum accepted value for fig.width? Looks like it is not effective to pass a value more than 12. I have been testing with different values for figure height and width for HTML output. I have ensured that the width value is not less than height always.

Upvotes: 5

Views: 2175

Answers (2)

User2321
User2321

Reputation: 3062

For anyone wishing to change this configuration from Rmarkdown you can include the following in your code (150% is just an example):

```{css, echo=FALSE}
img {
  max-width:150%;
  height: auto;
}
```

For more details read the excellent documentation https://bookdown.org/yihui/rmarkdown-cookbook/html-css.html

Upvotes: 2

Yihui Xie
Yihui Xie

Reputation: 30174

knitr does not impose any limits on fig.width. You can set it to any value allowed by the graphical device you use (for HTML output, the default device is png()).

The reason that you don't see a wider figure is due to the default CSS styles in HTML output: the maximum width of images has been set to 100%, i.e. images cannot be wider than the page.

Upvotes: 6

Related Questions