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 363par(mar=c(0,4,1,1))# small marginsplot.new()# new plotplot.window(xlim=c(−.5,26.5),ylim=c(0,8), asp=1) # setup limitsk = 0:25# pch values toplotzero = 0*k# same lengthas ktext(k, 8 + zero, labels=k)# add numberspoints(k,7 + zero, pch=k, cex=2) # add plotcharactersi=6:1# which linetypesabline(h=7−i,lty=i)# where to plotlineaxis(2,at=l:8,# at= <strong>for</strong> wherelabels=c(paste("lty =",i),"pch","k"), # labels <strong>for</strong> whatlas=2)# las=2 givesorientationFigure D.1 Example of pch= and lty=valuesD.1.3 Printing or saving a figureR prints its graphics to a device. Usually this device is the plot window we see, but itneed not be. It can also print to a file and store the output in different <strong>for</strong>mats. Forexample, R can store the current graphic in Adobe’s PDF <strong>for</strong>mat. This can be done byprinting the current screen device to a pdf device:## .. create a plot, and then…> dev.print(file="test.pdf",device=pdf)Adobe’s PDF <strong>for</strong>mat is great <strong>for</strong> sharing graphs, but it isn’t always the desired <strong>for</strong>mat <strong>for</strong>inserting into documents. By changing the argument device= to png or jpeg those filetypes will be saved. For some, PostScript is a convenient <strong>for</strong>mat. Encapsulated PostScriptcan be created with the function dev. copy2eps () For Windows GUI users, the plotwindow has menus <strong>for</strong> saving the graphic in png, jpeg, bmp, postscript, PDF, andmetafile <strong>for</strong>mats. The Mac OS X GUI allows the user to save graphics in its native PDF<strong>for</strong>mat.

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

Saved successfully!

Ooh no, something went wrong!