Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change R Markdown plot width [duplicate]

Tags:

plot

r

r-markdown

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.

like image 850
oleber Avatar asked May 17 '14 08:05

oleber


People also ask

How do I change the width of a plot in R?

To set plot line width/thickness in R, call plot() function and along with the data to be plot, pass required thickness/line-width value for the “lwd” parameter.

What is knitr RMarkdown?

RMarkdown is an extension to markdown which includes the ability to embed code chunks and several other extensions useful for writing technical reports. The rmarkdown package extends the knitr package to, in one step, allow conversion between an RMarkdown file (.Rmd) into PDF, HTML, word document, amongst others.

How do you plot a graph in R markdown?

In RStudio, when you open a new RMarkdown file, in the editor pane, there is a cogwheel button / menu where you can choose "Chunk Output Inline". That should put the plots into the document.


1 Answers

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.

like image 64
Eric Green Avatar answered Oct 10 '22 07:10

Eric Green