Anti-aliasing Graphics for Windows

Up until I started this blog, I exclusively worked in R through Linux. (I used a combination of RStudio Cloud servers and R through a Unix server in the past.) While working on my personal Windows machine, I noticed that the plots I made were of lower quality than my plots when using Linux. A recent /r/rstats Reddit thread asked a similar question. Users in the thread explained that the difference plot quality stems from Windows’ graphics engine not supporting anti-aliasing, and recommended the package Cairo to produce graphics with anti-aliasing in Windows.

x <- rnorm(100)
y <- rnorm(100)
plot(x, y)
title("Default Windows Graphics")

Now, when adding the option dev='CairoPNG' to the previous chunk:

plot(x, y)
title("Using Cairo")

I find that including this option allows for nice crisp plots that match my aesthetic ideas.

Avatar
Jack M. Wolf
Biostatistician and Educator

I’m an biostatistics PhD student at the University of Minnesota interested in causal inference, clinical trial design, and statistics and data science education.