7 Efficient visualisation

7.1 Rough outline

  • Efficient base graphics
    • Set up par function
    • Custom palettes
  • ggplot2
  • Interactive graphics
    • plotly, shiny, leaflet, htmlwidgets

7.2 Cairo type

These are just some thoughts/observations

When you use cairo to save plots, we get anti-aliasing. The standard graphic devices, png,and jpeg save graphics as either c("cairo", "Xlib", "quartz"). By default, it goes for getOption("bitmapType"). Unix-alike OSs, such as Linux, the default is cairo. Under Windows, the default is NULL. This results in the use of X11

For example, compare

set.seed(1)
x = rnorm(100)
png("fig1.png", type="cairo")
plot(x)
dev.off()

png("fig2.png", type="Xlib")
plot(x)
dev.off()
  • Can you just force type="cairo" in Windows - probably not.
  • If you use the cairo package under Windows, can you then access type="cairo". Or do you need to use the cairo:: functions.
  • No idea about Macs.

Search the web brings up a few out of date pages: