You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Plot resolution problem when using fig.asp and rendering R Notebook (Retina display) #2098
RStudio Edition : Desktop
RStudio Version : 1.1.419
OS Version : OS X 10.11.6 (on a MacBook Pro Retina 13-inch, Early 2015)
R Version : 3.4.3 (2017-11-30)
Steps to reproduce the problem
File > New File > R Notebook.
Replace the contents of the file with the following, removing the backslashes. (Sorry, I had to add these to prevent GitHub from messing up the formatting.)
---
output: html_notebook
---
Here is a plot.
\```{r}
plot(cars)
\```
Here is the same plot with `fig.asp` set.
\```{r fig.asp = 1}
plot(cars)
\```
Save the file with an .Rmd extension.
Code > Run Region > Run All
Describe the problem in detail
Here's the first plot.
Here's the second plot.
The text and points in the second plot are very small compared with the first plot.
Describe the behavior you expected
Here's what the second plot looks like when the page is rendered using rmarkdown::render in command-line R.
I've also noticed problems when using fig.width and fig.height. Behaviour has been different when I drag RStudio on to a second monitor so perhaps the issue is caused by my MacBook's retina display.
There's still a problem when viewing using the 'Preview' button, but not when knitting to HTML.
Reacted by Nick DiQuattro, Arun Chavan and Christophe Dervieux
@gregrs-uk Thank you for raising the issue, and I will mark it as a bug for review. In the meantime, one workaround is to adjust the size with cex—e.g. par(cex = 2.5)—which will increase the size within the preview. However, you'll need to remove it when knitting the document.
This issue is still going on, at least for me. Plots in the Notebook are very small, but knitting the whole document displays them at their proper resolution. It's to the point where if I want to see the plot I have to knit the whole document.
Activity
ronblum commentedon Feb 9, 2018
@gregrs-uk Thank you for raising the issue, and I will mark it as a bug for review. In the meantime, one workaround is to adjust the size with cex—e.g.
par(cex = 2.5)—which will increase the size within the preview. However, you'll need to remove it when knitting the document.gregrs-uk commentedon Feb 9, 2018
Thanks for the workaround, Ron.
gregrs-uk commentedon May 1, 2019
Looks like this is possibly related to #4521
eleozzr commentedon Nov 2, 2020
But what if ggplot? how to fix it?
stale commentedon Feb 4, 2021
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, per https://github.com/rstudio/rstudio/wiki/Issue-Grooming. Thank you for your contributions.
mikebessuille commentedon Feb 12, 2021
We see quite a few issues related to plot resolution, so I don't want this issue to go stale. We'll try to look at it in 1.6
megaraptor1 commentedon Aug 27, 2022
This issue is still going on, at least for me. Plots in the Notebook are very small, but knitting the whole document displays them at their proper resolution. It's to the point where if I want to see the plot I have to knit the whole document.
ronblum commentedon Dec 2, 2022
Moving to Cherry Blossom, in order to verify that it's fixed by PR #12324. If it's not, we'll reassign it to the current milestone.
jonvanausdeln commentedon Feb 6, 2023
Verified with 2023.03.0-daily+280. The text and points of the plots are the same in each plot as expected.