Skip to content
Prev 390890 / 398513 Next

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

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