资源描述:
《the r book 2nd edition》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、29ChangingtheLookofGraphicsManyofthechangesthatyouwillwanttomaketothelookofyourgraphicsinvolvetheuseofthegraphicsparametersfunction,par.Otherchanges,however,canbemadethroughalterationstotheargumentstohigh-levelfunctionssuchasplot,points,lines,axis,titleandtext(theseoptionsareshow
2、nwithanasteriskinTable29.2).29.1GraphsforpublicationThemostlikelychangesyouwillbeaskedtomakearetotheorientationofthenumbersonthetickmarks,andtothesizesoftheplottingsymbolsandtextlabelsontheaxes.Therearefourfunctionsinvolvedhere:lasdeterminestheorientationofthenumbersonthetickmark
3、s;cexdeterminesthesizeofplottingcharacters(pch);cex.labdeterminesthesizeofthetextlabelsontheaxes;cex.axisdeterminesthesizeofthenumbersonthetickmarks.Hereweshowfourdifferentcombinationsofoptions.Youshouldpickthesettingsthatlookbestforyourparticulargraph.par(mfrow=c(2,2))x<-seq(0,1
4、50,10)y<-16+x*0.4+rnorm(length(x),0,6)plot(x,y,pch=16,col="blue",xlab="labelforxaxis",ylab="labelforyaxis")plot(x,y,pch=16,col="blue",xlab="labelforxaxis",ylab="labelforyaxis",las=1,cex.lab=1.2,cex.axis=1.1)plot(x,y,pch=16,col="blue",xlab="labelforxaxis",ylab="labelforyaxis",las=
5、2,cex=1.5)plot(x,y,pch=16,col="blue",xlab="labelforxaxis",ylab="labelforyaxis",las=3,cex=0.7,cex.lab=1.3,cex.axis=1.3)TheRBook,SecondEdition.MichaelJ.Crawley.©2013JohnWiley&Sons,Ltd.Published2013byJohnWiley&Sons,Ltd.908THERBOOKThetopleft-handgraphusesallthedefaultsettings:las=0,c
6、ex=1,cex.lab=1Inthetopright-handgraphthenumbershavebeenrotatedsothattheyareallvertical(las=1),thelabelsizehasbeenincreasedby20%andthenumbersby10%:las=1,cex=1,cex.lab=1.2,cex.axis=1.1Inthebottomleft-handgraphtheplottingsymbol(pch=16)hasbeenincreasedinsizeby50%andthenumbersonbothax
7、esareparallelwiththeiraxes(las=2):las=2,cex=1.5,cex.lab=1Finally,inthebottomright-handgraphthelabelsizehasbeenincreasedby30%,theplottingsymbolsreducedby30%andtheaxesnumbersareallat90degrees(las=3):las=3,cex=0.7,cex.lab=1.3,cex.axis=1.3Myfavouriteisthetopright-handgraphwithslightl
8、ylargertextandnumbersandwithverticalnumb