Chapter 29

Changing the Look of Graphics

Many of the changes that you will want to make to the look of your graphics involve the use of the graphics parameters function, par. Other changes, however, can be made through alterations to the arguments to high-level functions such as plot, points, lines, axis, title and text (these options are shown with an asterisk in Table 29.2).

29.1 Graphs for publication

The most likely changes you will be asked to make are to the orientation of the numbers on the tick marks, and to the sizes of the plotting symbols and text labels on the axes. There are four functions involved here:

las determines the orientation of the numbers on the tick marks;
cex determines the size of plotting characters (pch);
cex.lab determines the size of the text labels on the axes;
cex.axis determines the size of the numbers on the tick marks.

Here we show four different combinations of options. You should pick the settings that look best for your particular graph.

par(mfrow=c(2,2))
x <- seq(0,150,10)
y <- 16+x*0.4+rnorm(length(x),0,6)
 		
plot(x,y,pch=16,col="blue",xlab="label for x axis",
			ylab="label for y axis")
plot(x,y,pch=16,col="blue",xlab="label for x axis",
			ylab="label for y axis",
			las=1,cex.lab=1.2, cex.axis=1.1)
plot(x,y,pch=16,col="blue",xlab="label for x axis",
			ylab="label for y axis",las=2,cex=1.5)
plot(x,y,pch=16,col="blue",xlab="label for x axis",
			ylab="label for y axis",las=3,
			cex=0.7,cex.lab=1.3, cex.axis=1.3)

The top left-hand graph ...

Get The R Book, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.