10.07.2015 Views

Using R for Introductory Statistics : John Verzani

Using R for Introductory Statistics : John Verzani

Using R for Introductory Statistics : John Verzani

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Appendix D 358A device is set up with a certain size given by din=. A figure’s size is given by thegraphical parameter fin=. The figure is made up of its margins and the plot region. Theseare stored under mai= and pin=.For example,> par("din","fin","pin","mai”)$din# device size[1] 6.995 6.996$fin# figure size[1] 6.995 6.996$pin# plot size[1] 6.133 5.717$mai# margin sizes[1] 0.7088 0.5698 0.5698 0.2919The first three specify the sizes in inches <strong>for</strong> width and height. As margins may benonsymmetric, there are four values specified: the bottom, left, top, and right.The values add up as shown by> .5698+.2919 +6.133 # widths[1] 6.995> .7088+.5698 +5.717 # heights[1] 6.996The margins can also be specified by the number of lines of text that can be printed usingmar=. The actual size is relative to the current point size of the text. The argument plt=can specify the plot region in terms of the device size.These areas are usually set up <strong>for</strong> us when the plot device is. At this point, the overallwidth and height are given, and R makes the necessary computations <strong>for</strong> the margins. Ifwe are unsatisfied with the defaults, we can override the calculated values. If the marginsor space <strong>for</strong> the main graphic are made too small, an error message will be given.Multi-graphic figuresIn a few examples in this text, more than one graphic is plotted on the same figure. Forexample, when we plotted the diagnostic plots after fitting a linear model, four graphicswere returned. These can be seen one after another, or can be <strong>for</strong>ced to show up all fourat once if the graphic parameter mfrow= is set to c(2,2).The parameter mfrow= stores two values as a vector. A value of c(3,2) says to split thefigure into six equal pieces, with three rows and two columns. The default is c (1,1).Figures are filled in row by row. Use mf col= to fill in column by column. To advance tothe next area to draw a graphic, we can use a high-level plot command or the functionplot. new ().The f ig= graphical parameter controls the amount of the current figure the nextgraphic will use. By default, this is set to c (0,1,0,1), indicating the whole figure. The firsttwo numbers are the x value, and the second two are y. They refer to the lower left of thefigure. For example, a value like c(0,1/2,1/2,1) will use the upper-left part of the figure.The parameter new= should be set to TRUE to add to the existing figure with a high-levelplot command.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!