(Screen) graphics quality on Windows

For reasons not worth going into, I've recently switched from macOS to Windows. Something that has really stuck out to me thus far is the really poor quality of graphics produced during interactive use in R. This isn't an RStudio-specific problem really as it makes no difference whether one is using R GUI, command line, or RStudio.

The basic difference it appears to me is that macOS/quartz and Linux/X11 use antialiasing for all lines in the graphics and the Windows graphics device does not (just fonts). This makes a pretty significant difference in my view, though, in the quality of certain plots — especially if they contain things like diagonal or curved lines (the output looks jagged). I know I can still export in vector formats with high quality and it's not too difficult to export to PNG et al. via Cairo to get better saved graphics (though I haven't figured out how to make knitr do this by default yet).

But in interactive use, graphics frankly look terrible to me on the screen graphics device. Maybe if you have only used Windows, your eye wouldn't be trained to notice this but I was shocked as I transitioned from macOS to Windows. I know that this isn't the world's biggest problem, but I really would like to be able to look at graphics interactively and have them look decent.

My only solution thus far has been to add

options(device = Cairo::CairoWin)

to my .Rprofile, which is basically good enough to me when using R from the command line. I'm told there is a performance penalty with Cairo but it's imperceptible on my machine. With that said, this doesn't change anything with RStudio, which I'd prefer to use. Is there a way to tweak RStudio's graphics device? Is there anything else I'm missing in terms of options for improving graphics quality?

Side note: I can use a Windows X11 server with Windows Subsystem for Linux and get nice looking graphics from the Ubuntu install of R, which is both pretty cool and irritating that this hacky method works but Windows defaults are so poor.

1 Like

Have you tried windows.options(antialias = "cleartype")?

Actually, from this old R release

The default behaviour (unchanged from before) is that Windows will use anti-aliasing for screen devices (and bitmap devices, as they plot on a hidden screen) if ClearType has been enabled. For those not using ClearType, windows.options(antialias = "cleartype") will make this the default, and it will probably give more legible plots.

Seems that you don't even need to set that option if you have already enabled ClearType. Have you?

Yes I have. Unfortunately, that only antialiases fonts.

For a visual example, I've screenshotted the default behavior with a simple line plot with ggplot2.

The fonts look lovely, but if your eyes move along the line you'll see that it's a fairly bumpy ride.

Have you explored the resolution option?


Here's a longer article I recall being helpful,


1 Like

Mmmm...

I think that you will have to drop Windows and move to linux :wink: :smile: