16

I'm starting working with R Markdown and I'm not understanding how to generate bigger plots. With today screens the plots can be much bigger.

How do I control the plots width/heigh in a Markdown report?

Thanks for the help.

hrbrmstr
  • 77,368
  • 11
  • 139
  • 205
oleber
  • 1,089
  • 4
  • 12
  • 25
  • 1
    see [this answer](http://stackoverflow.com/questions/17963962/plot-size-and-resolution-with-r-markdown-knitr-pandoc-beamer) – Eric Green May 17 '14 at 08:54
  • I was able to do it for each chunk with: ```{r, out.width = '750px', dpi=200} Since I have allot of plots on my document, How do I do it globally? – oleber May 17 '14 at 16:50
  • 3
    if that works, then in your first chunk, before you do any plots, add this inside the chunk like any regular R syntax: `opts_chunk$set(out.width='750px', dpi=200)`. see [chunk options](http://yihui.name/knitr/options#chunk_options) – Eric Green May 17 '14 at 17:50
  • Eric give the answer. How can one close a question in stackoverflow? – oleber May 20 '14 at 08:36
  • 1
    First, this question is not a duplicate of the other. It is clearly about pixels, and thus HTML output, not about inches (LaTeX output, like the other). Second, I don't find the answers sufficient, because the HTML output seems to cap the maximum image dimensions. Using 1000px helps me a little, but I want it bigger; using 2000px gives identical results. – Nathan Oct 11 '16 at 15:39

1 Answers1

20

See this SO answer for how to specify these details in chunks.

To set global chunk options, use opts_chunk$set(out.width='750px', dpi=200) inside your first chunk. See this page on chunk options for more.

Community
  • 1
  • 1
Eric Green
  • 7,385
  • 11
  • 56
  • 102