-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plots are rendered differently on different monitors #7028
Comments
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. |
This issue has been automatically closed due to inactivity. |
I have the same issue. This isn't restricted to ggplot
Retina display: External display: HTML Output Matches External DisplayWhen the document is knit to html, using the default options, the generated images are small, the same as those seen on the external display.
|
I don't know if there is an issue with RStudio or not. Regarding last comment, I answered here rstudio/rmarkdown#1827 (comment) on how |
This discussion on twitter is relevant to this issue, and includes this nice but hacky fix. |
@ronblum would it be possible to reopen this issue closed by stale bot ? Seems still an issue and related to a few others about resolution of figure in Notebook . Thanks! |
I see a few problems that mostly center around [this code] ( rstudio/src/cpp/session/modules/NotebookPlots.R Lines 27 to 30 in 2c92cd9
In at least one customer situation, it seems like we need a way to disable the effect of the retina, or to at least not double it up because the results of ggplot are not consistent with other graphics they are rendering. |
I believe this is where R is computing the scaling factor based on 'res' supplied above: confirming to me that we don't have to do the scaling twice. These particular plots have fixed_width attribute set and the code to render the img tag is here: Lines 58 to 62 in dc7f9e1
To correct the plot size, the easiest thing would be to just remove the " * pixelRatio" in NotebookPlot.R in all 6 places where it appears. The img tag is already correcting for devicePixelRatio by scaling up the image by that factor. The downside of that is less clear plot images on retina. BTW, I found an easier to way to check the devicePixelRatio used by RStudio is:
|
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. |
I tried on latest daily, 2023.03.0-daily+280. However, I would like confirmation from @Mashin6 and/or @EoinTravers that this solves their issue. |
Thank you @Mashin6! Since the main issue is resolved, I will close out this issue. Would you be able to open a new issue on what you are still experiencing? I would be happy to open if you'd like, I just don't want to miss any details. |
@jeffvroom Is there a way to set the device pixel ratio from a current RStudio session, similar to the |
@frederikziebell I suspect not, but you might want to file a separate issue to make sure your request isn't lost. |
I originally reported the problem in RMarkdown project 4521 and this might be issue related to 1827
System details
Steps to reproduce the problem
Describe the problem in detail
RStudio renders figures inconsistently depending on which monitor is the code executed. When I run code chunk on retina display the text in the figure is rendered smaller, but when I move the window to my second 2K display (ThinkVision 23.8'' P24H-10 QHD) all the labels and margins are rendered way larger, which dramatically change how the figure looks like.
Here is a sample code (cowplot package is to exaggerate the issue, but it behaves the same when cowplot is deactivated)
Output 1:1 screenshots:
The text was updated successfully, but these errors were encountered: