[R] dev.size() does not return correct size on 4K screen

peter dalgaard pd@|gd @end|ng |rom gm@||@com
Wed Mar 2 23:11:57 CET 2022


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 using 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 using 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes using cbs.dk  Priv: PDalgd using gmail.com



More information about the R-help mailing list