dev.size() does not return correct size on 4K screen
Thank you, Peter!
From xdpyinfo I got
screen #0:
? dimensions:??? 5120x2880 pixels (903x508 millimeters)
? resolution:??? 144x144 dots per inch
According to these specs my screen should have a sqrt((5120/144)^2 +
(2880/144)^2) = 40.8" diagonal.
However, in practice it is 27", so that perfectly explains the 1.5
factor difference.
In RStudio, dev.size() is not equal to par("fin"), which caused the
problem for me. I the R terminal, these two are equal. I'll post this in
the RStudio issue list.
Best,
Martijn
On 3/2/22 23:11, peter dalgaard wrote:
I don't know about RStudio, but in X11 this sort of thing can happen due to misconfiguration of the display itself, i.e. not in R as such. Basically, it relies on getting the correct dots-per-inch value from the display, and may otherwise use some standard value. What happens if you run xdpyinfo in a terminal window? With XQuartz on an MB Air, I see ... screen #0: dimensions: 1440x876 pixels (381x232 millimeters) resolution: 96x96 dots per inch ... which is a multi-way lie! It is a 2560x1600 retina display, the resolution is way higher than 96x96, and it is 13.3", whereas the stated dimensions corresponds to a 17" diagonal. However, systems may be "lying in the users best interest", since e.g. the default for an X11() plot window is 7in square, which might not fit on a small laptop. You are somewhat more likely to want the same relative size across different laptops. - pd
On 2 Mar 2022, at 10:52 , Martijn Tennekes <mtennekes at gmail.com> wrote: dev.size() does not return the correct screen size when using a 4K screen. With the R console and a x11() device, it seems to overestimate with factor 1.5, and in RStudio underestimate with factor 2. See also https://github.com/rstudio/rstudio/issues/10723 Is this a bug, or is there something I can do? Best, Martijn Tennekes [[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.