[Rd] Support for high DPI 4K screens

Tom Wenseleers Tom.Wenseleers at bio.kuleuven.be
Sat Sep 5 22:20:06 CEST 2015

Hi Brian,
Thanks for your message. Just to clarify - I've seen this problem on Windows both under Windows 8.1 and Windows 10, and the RStudio people were also aware of the problem (it's also a known problem on Linux btw, https://support.rstudio.com/hc/communities/public/questions/201913407-RStudioGD-option-to-set-screen-DPI?locale=en-us )... I gathered that part of the problem is the difficulty to scale a graphics window without affecting the relative scaling of the plot elements (text, line widths etc), which is why in RStudio they now rely on the inbuilt dpi scaling of Windows, which merely upscales the low res image by a factor of 2 if you set the zoom factor to 2 (resulting in a blurry plot window). Not using dpi scaling or zooming is also an option, but then one typically has to make one's plot window larger, thereby requiring one to adjust the scaling of all plot elements, e.g. in ggplot2, ie text sizes, plot symbol sizes, line sizes etc due to the fact that all those sizes are specified as absolute sizes... Other problem is that without zooming the default text sizes of all standard ggplot2 themes e.g. are much too small. 

This made me wonder if in some future edition such problems could not be solved by allowing graphics to scale proportionally, maybe with some optional zoom factor or something, or by being able to specify how many ppi one's screen is? Many people I know that use R would also love to be able to maximize their plot window without it affecting the scaling of all the text etc in the graph. Right now one is pretty much tied to exporting as PDF and then viewing that full screen... Or am I overlooking something? I am just asking this question here as I have a feeling that a solution to this problem would probably be most conveniently addressed somewhere at a low level in grDevices or grid...

best regards,

From: R-devel [r-devel-bounces at r-project.org] on behalf of Brian G. Peterson [brian at braverock.com]
Sent: 05 September 2015 15:56
To: r-devel at r-project.org
Subject: Re: [Rd] Support for high DPI 4K screens

On 09/05/2015 06:46 AM, Tom Wenseleers wrote:
> I was recently testing R and RStudio on a high dpi 4K monitor under
> Windows and noticed that the plot window cannot be scaled or zoomed
> without affecting the relative sizing of all plot elements (line
> widths, font sizes, legend spacing etc). RStudio seems to try to
> overcome this by enabling dpi scaling for the plot window on high dpi
> screens, but this results in really fuzzy text and graphics (e.g.
> causing colour fringing when using Cleartype). This made me wonder if
> the assumed dpi of the screen could perhaps be set using some global
> option, so that all graphics could be made to scale their contents in
> a correct way, without affecting the size relative to the size of the
> plot window (I think now it is always assumed to be 72 dpi)? I
> recently asked a related question re how to scale R graphics
> proportionally to the size of the plot window on Stackoverflow,
> http://stackoverflow.com/questions/31381066/r-function-to-make-plot-symbols-line-widths-and-text-in-ggplot2-lattice-and-b/32412384#32412384
> but nobody seemed to be able to come up with a good answer/solution.
> This made me wonder if there could perhaps be some low-level solution
> to this?

R-help or RStudio support seem more appropriate for this?

'The correct way' is a very subjective term.  I really don't want R or
any other application or operating system assuming that I bought a whole
bunch of expensive 4k displays for smoother lines.  I bought them for
pixel count.

We routinely use R and RStudio on 4k displays, I'm doing so right now.

The problem you are likely having is an old version of Windows, and has
little or nothing to do with R or RStudio.  Windows 8 and higher have
extensive application scaling support.

Of course, Macs and Linux have good scaling support also, and you get
better R performance on Macs and Linux as well.

Even on Windows, we typically run almost all our applications on 4k
displays at native resolution, and only change title bar and menu
scaling based on distance to the screen.  We also use all those pixels.

Your use cases, of course, may vary. Which, in part, is why R has so
much control over the types of graphic devices you create, and how you
choose to control them.



Brian G. Peterson
Ph: 773-459-4973
IM: bgpbraverock

R-devel at r-project.org mailing list

More information about the R-devel mailing list