Standard Windows plot:

  n <- 400
  a <- 2
  b <- -6
  sigSq <- 0.5
  x <- runif(n)
  y <- a + b * x + rnorm(n, sd = sqrt(sigSq * x))
  plot(x, y)
  abline(a, b, col = "purple", lwd = 1.5)

plot of chunk StandardPlot

Cairo plot (note that this is using the exact same R code as above):

  n <- 400
  a <- 2
  b <- -6
  sigSq <- 0.5
  x <- runif(n)
  y <- a + b * x + rnorm(n, sd = sqrt(sigSq * x))
  plot(x, y)
  abline(a, b, col = "purple", lwd = 1.5)

plot of chunk CairoPlot

Here's a side-by-side comparison of the standard Windows plot (left) with a Cairo plot (right). Both plots have been magnified by 300%.

Magnified comparison of standard plots against Cairo plots.

Markdown to produce a Cairo plot with knitr (I've written the chunk surrounded by two backticks instead of three so they don't interfere with the markdown for this document; you must use three backticks to denote a code chunk):

``{r CairoPlot, dev='CairoPNG'}
n <- 400
a <- 2
b <- -6
sigSq <- 0.5
x <- runif(n)
y <- a + b * x + rnorm(n, sd = sqrt(sigSq*x))
plot(x, y)
abline(a, b, col = "purple", lwd=1.5)
``

Note that all that's been changed is the addition of the dev='CairoPNG' option to the chunk options of the R Markdown (I've also named the chunk CairoPlot, but that's not necessary and does not affect the rendering of the plot).

Here's the R Markdown used to create this file.