Changing plot print aspect ratio or size in an R notebook in RStudio without the plot becoming full width

I would like to change the aspect ratio or figure size of a plot that gets printed within an R notebook in RStudio.

I'm able to adjust the aspect ratio with the fig.asp chunk argument. For example, in the minimal example below, the plot aspect ratio correctly becomes 2. However, at the same time, the plot also becomes very large, full width within the notebook (screenshot below). How can I change the aspect ratio without the plot becoming full width within my notebook? Specifying fig.width or out.width arguments doesn't make a difference.

Environment:

R version: 3.6.1 (2019-07-05)
RStudio version: 1.2.1541
platform       x86_64-apple-darwin15.6.0   
arch           x86_64                      
os             darwin15.6.0                
system         x86_64, darwin15.6.0 

Minimal example:

---
title: "R Notebook"
output: html_notebook
---

This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. When you 
execute code within the notebook, the results appear beneath the code. 

Try executing this chunk by clicking the *Run* button within the chunk or 
by placing your cursor inside it and pressing *Cmd+Shift+Enter*. 

```{r, fig.asp=2, fig.width='200px'}
plot(cars)
```

Problem:

enter image description here

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.