3.4) Graphical Parameters
If you type ?par
, you’ll glimpse the range of graphical parameters that may be specified. In order to set graphical parameters for all subsequent plots, use par()
as a function in its own right. Try the following command to set up graphics suitable for some journals, and use the help file to see what the arguments mean:
par(mar=c(4,4,1,1), mgp=c(2,0.5,0), tck=0.02, bty="l", las=1, ps=12)
Another useful argument to par()
is mfrow=
, used to divide the graphics window up into rows and columns for multiple figures.
- Specify
par(mfrow=c(2,3))
and then experiment with plots from the columns of the installed data frameswiss
. Start by typingstr(swiss)
(in some environments you may need to typedata(swiss)
first) to see what columns this data frame has. - Re-do your plots with appropriate axis labels using
xlab=
andylab=
. (Note that you can’t normally edit plots in R; you just edit the code in your script window and re-run it.) - Adjust the shape of the graphics window by dragging its corner, noting what happens to the relative sizes of text and graphics.