11/2/2020
Chapter 7 - Better Graphics
- demo(graphics) - a quick look at some of the available plots and visuals in R
- Graphics Devices
- windows for Windows
- quartz for Mac
- X11 for Unix
- par() command
- gives you a list of graphics parameters
- you can get the values of particular graphics parameters, e.g., par("pch") shows you the default plotting character
- can be used to change a graphics parameter for a graphics device
- Tip: It is useful to save your par() settings so that they can easily be reset.
- R uses MML (Mathematical Markup Language)
- To produce more permanent graphs (to a file, rather than a window or the screen) simply wrap the plotting command in code that opens and closes the relevant graphics device.
- Different types of graphics
- Raster-style graphics - jpeg, png, bmp
- Vector-style graphics - pdf, postscript, windows metafile
- Many users prefer vector-style graphics because they are scalable
- Different options in R
- Base graphics engine - not always convenient, especially for 3D and other sophisticated graphs
- lattice package - Trellis graphics developed at Bell Labs
- ggplot2 - based on The Grammar of Graphics, another very popular option
- See Graphics.R for lots of examples from Chapter 7
Please read Chapter 7 and begin Chapter 8 for class on Wednesday.