Você está na página 1de 12

21/10/2016 R:SetorQueryGraphicalParameters

par{graphics} RDocumentation

SetorQueryGraphicalParameters

Description

parcanbeusedtosetorquerygraphicalparameters.Parameterscanbesetbyspecifyingthemasarguments
toparintag=valueform,orbypassingthemasalistoftaggedvalues.

Usage

par(...,no.readonly=FALSE)

<highlevelplot>(...,<tag>=<value>)

Arguments

...
argumentsintag=valueform,oralistoftaggedvalues.Thetagsmustcomefromthenames
ofgraphicalparametersdescribedintheGraphicalParameterssection.

no.readonly
logicalifTRUEandtherearenootherarguments,onlyparametersarereturnedwhichcanbeset
byasubsequentpar()callonthesamedevice.

Details

Eachdevicehasitsownsetofgraphicalparameters.Ifthecurrentdeviceisthenulldevice,parwillopena
newdevicebeforequerying/settingparameters.(Whatdeviceiscontrolledbyoptions("device").)

Parametersarequeriedbygivingoneormorecharactervectorsofparameternamestopar.

par()(noarguments)orpar(no.readonly=TRUE)isusedtogetallthegraphicalparameters(asanamed
list).Theirnamesarecurrentlytakenfromtheunexportedvariablegraphics:::.Pars.

R.O.indicatesreadonlyarguments:Thesemayonlybeusedinqueriesandcannotbeset.("cin","cra",
"csi","cxy","din"and"page"arealwaysreadonly.)

Severalparameterscanonlybesetbyacalltopar():

"ask",

"fig","fin",

"lheight",

"mai","mar","mex","mfcol","mfrow","mfg",

"new",

"oma","omd","omi",

"pin","plt","ps","pty",

"usr",

"xlog","ylog",

"ylbias"
http://127.0.0.1:15529/library/graphics/html/par.html 1/12
21/10/2016 R:SetorQueryGraphicalParameters

Theremainingparameterscanalsobesetasarguments(oftenvia...)tohighlevelplotfunctionssuchas
plot.default,plot.window,points,lines,abline,axis,title,text,mtext,segments,symbols,arrows,
polygon,rect,box,contour,filled.contourandimage.Suchsettingswillbeactiveduringtheexecutionof
thefunction,only.However,seethecommentsonbg,cex,col,lty,lwdandpchwhichmaybetakenas
argumentstocertainplotfunctionsratherthanasgraphicalparameters.

Themeaningofcharactersizeisnotwelldefined:thisissetupforthedevicetakingpointsizeinto
accountbutoftennottheactualfontfamilyinuse.Internallythecorrespondingpars(cra,cin,cxyandcsi)
areusedonlytosettheinterlinespacingusedtoconvertmarandomatophysicalmargins.(Thesameinter
linespacingmultipliedbylheightisusedformultilinestringsintextandstrheight.)

Notethatgraphicalparametersaresuggestions:plottingfunctionsanddevicesneednotmakeuseofthem
(andthisisparticularlytrueofnondefaultmethodsfore.g.plot).

Value

Whenparametersareset,theirpreviousvaluesarereturnedinaninvisiblenamedlist.Suchalistcanbe
passedasanargumenttopartorestoretheparametervalues.Usepar(no.readonly=TRUE)forthefulllistof
parametersthatcanberestored.However,restoringalloftheseisnotwise:seetheNotesection.

Whenjustoneparameterisqueried,thevalueofthatparameterisreturnedas(atomic)vector.Whentwoor
moreparametersarequeried,theirvaluesarereturnedinalist,withthelistnamesgivingtheparameters.

Notetheinconsistency:settingoneparameterreturnsalist,butqueryingoneparameterreturnsavector.

GraphicalParameters

adj

Thevalueofadjdeterminesthewayinwhichtextstringsarejustifiedintext,mtextandtitle.A
valueof0producesleftjustifiedtext,0.5(thedefault)centeredtextand1rightjustifiedtext.(Any
valuein[0,1]isallowed,andonmostdevicesvaluesoutsidethatintervalwillalsowork.)

Notethattheadjargumentoftextalsoallowsadj=c(x,y)fordifferentadjustmentinxandy
directions.Notethatwhereasfortextitreferstopositioningoftextaboutapoint,formtextandtitle
itcontrolsplacementwithintheplotordeviceregion.

ann

IfsettoFALSE,highlevelplottingfunctionscallingplot.defaultdonotannotatetheplotsthey
producewithaxistitlesandoveralltitles.Thedefaultistodoannotation.

ask

logical.IfTRUE(andtheRsessionisinteractive)theuserisaskedforinput,beforeanewfigureis
drawn.Asthisappliestothedevice,italsoaffectsoutputbypackagesgridandlattice.Itcanbeset
evenonnonscreendevicesbutmayhavenoeffectthere.

Thisnotreallyagraphicsparameter,anditsuseisdeprecatedinfavourofdevAskNewPage.

bg

Thecolortobeusedforthebackgroundofthedeviceregion.Whencalledfrompar()italsosetsnew=
FALSE.SeesectionColorSpecificationforsuitablevalues.Formanydevicestheinitialvalueisset
fromthebgargumentofthedevice,andfortherestitisnormally"white".

Notethatsomegraphicsfunctionssuchasplot.defaultandpointshaveanargumentofthisname
withadifferentmeaning.

bty
http://127.0.0.1:15529/library/graphics/html/par.html 2/12
21/10/2016 R:SetorQueryGraphicalParameters

Acharacterstringwhichdeterminedthetypeofboxwhichisdrawnaboutplots.Ifbtyisoneof"o"
(thedefault),"l","7","c","u",or"]"theresultingboxresemblesthecorrespondinguppercaseletter.
Avalueof"n"suppressesthebox.

cex

Anumericalvaluegivingtheamountbywhichplottingtextandsymbolsshouldbemagnifiedrelative
tothedefault.Thisstartsas1whenadeviceisopened,andisresetwhenthelayoutischanged,e.g.by
settingmfrow.

Notethatsomegraphicsfunctionssuchasplot.defaulthaveanargumentofthisnamewhich
multipliesthisgraphicalparameter,andsomefunctionssuchaspointsandtextacceptavectorof
valueswhicharerecycled.

cex.axis

Themagnificationtobeusedforaxisannotationrelativetothecurrentsettingofcex.

cex.lab

Themagnificationtobeusedforxandylabelsrelativetothecurrentsettingofcex.

cex.main

Themagnificationtobeusedformaintitlesrelativetothecurrentsettingofcex.

cex.sub

Themagnificationtobeusedforsubtitlesrelativetothecurrentsettingofcex.

cin

R.O.charactersize(width,height)ininches.Thesearethesamemeasurementsascra,expressedin
differentunits.

col

Aspecificationforthedefaultplottingcolor.SeesectionColorSpecification.

Somefunctionssuchaslinesandtextacceptavectorofvalueswhicharerecycledandmaybe
interpretedslightlydifferently.

col.axis

Thecolortobeusedforaxisannotation.Defaultsto"black".

col.lab

Thecolortobeusedforxandylabels.Defaultsto"black".

col.main

Thecolortobeusedforplotmaintitles.Defaultsto"black".

col.sub

Thecolortobeusedforplotsubtitles.Defaultsto"black".

cra

http://127.0.0.1:15529/library/graphics/html/par.html 3/12
21/10/2016 R:SetorQueryGraphicalParameters

R.O.sizeofdefaultcharacter(width,height)inrasters(pixels).Somedeviceshavenoconceptof
pixelsandsoassumeanarbitrarypixelsize,usually1/72inch.Thesearethesamemeasurementsas
cin,expressedindifferentunits.

crt

Anumericalvaluespecifying(indegrees)howsinglecharactersshouldberotated.Itisunwiseto
expectvaluesotherthanmultiplesof90towork.Comparewithsrtwhichdoesstringrotation.

csi

R.O.heightof(defaultsized)charactersininches.Thesameaspar("cin")[2].

cxy

R.O.sizeofdefaultcharacter(width,height)inusercoordinateunits.par("cxy")is
par("cin")/par("pin")scaledtousercoordinates.Notethatc(strwidth(ch),strheight(ch))fora
givenstringchisusuallymuchmoreprecise.

din

R.O.thedevicedimensions,(width,height),ininches.Seealsodev.size,whichisupdated
immediatelywhenanonscreendevicewindowsisresized.

err

(UnimplementedRissilentwhenpointsoutsidetheplotregionarenotplotted.)Thedegreeoferror
reportingdesired.

family

Thenameofafontfamilyfordrawingtext.Themaximumallowedlengthis200bytes.Thisnamegets
mappedbyeachgraphicsdevicetoadevicespecificfontdescription.Thedefaultvalueis""which
meansthatthedefaultdevicefontswillbeused(andwhatthoseareshouldbelistedonthehelppage
forthedevice).Standardvaluesare"serif","sans"and"mono",andtheHersheyfontfamiliesarealso
available.(Devicesmaydefineothers,andsomedeviceswillignorethissettingcompletely.Names
startingwith"Hershey"aretreatedspeciallyandshouldonlybeusedforthebuiltinHersheyfont
families.)Thiscanbespecifiedinlinefortext.

fg

Thecolortobeusedfortheforegroundofplots.Thisisthedefaultcolorusedforthingslikeaxesand
boxesaroundplots.Whencalledfrompar()thisalsosetsparametercoltothesamevalue.Seesection
ColorSpecification.Afewdeviceshaveanargumenttosettheinitialvalue,whichisotherwise
"black".

fig

Anumericalvectoroftheformc(x1,x2,y1,y2)whichgivesthe(NDC)coordinatesofthefigure
regioninthedisplayregionofthedevice.Ifyousetthis,unlikeS,youstartanewplot,sotoaddtoan
existingplotusenew=TRUEaswell.

fin

Thefigureregiondimensions,(width,height),ininches.Ifyousetthis,unlikeS,youstartanew
plot.

font

http://127.0.0.1:15529/library/graphics/html/par.html 4/12
21/10/2016 R:SetorQueryGraphicalParameters

Anintegerwhichspecifieswhichfonttousefortext.Ifpossible,devicedriversarrangesothat1
correspondstoplaintext(thedefault),2toboldface,3toitalicand4tobolditalic.Also,font5is
expectedtobethesymbolfont,inAdobesymbolencoding.Onsomedevicesfontfamiliescanbe
selectedbyfamilytochoosedifferentsetsof5fonts.

font.axis

Thefonttobeusedforaxisannotation.

font.lab

Thefonttobeusedforxandylabels.

font.main

Thefonttobeusedforplotmaintitles.

font.sub

Thefonttobeusedforplotsubtitles.

lab

Anumericalvectoroftheformc(x,y,len)whichmodifiesthedefaultwaythataxesareannotated.
Thevaluesofxandygivethe(approximate)numberoftickmarksonthexandyaxesandlen
specifiesthelabellength.Thedefaultisc(5,5,7).Notethatthisonlyaffectsthewaytheparameters
xaxpandyaxparesetwhentheusercoordinatesystemissetup,andisnotconsultedwhenaxesare
drawn.lenisunimplementedinR.

las

numericin{0,1,2,3}thestyleofaxislabels.

0:

alwaysparalleltotheaxis[default],

1:

alwayshorizontal,

2:

alwaysperpendiculartotheaxis,

3:

alwaysvertical.

Alsosupportedbymtext.Notethatstring/characterrotationviaargumentsrttopardoesnotaffectthe
axislabels.

lend

Thelineendstyle.Thiscanbespecifiedasanintegerorstring:

and"round"meanroundedlinecaps[default]

http://127.0.0.1:15529/library/graphics/html/par.html 5/12
21/10/2016 R:SetorQueryGraphicalParameters

and"butt"meanbuttlinecaps

and"square"meansquarelinecaps.

lheight

Thelineheightmultiplier.Theheightofalineoftext(usedtoverticallyspacemultilinetext)isfound
bymultiplyingthecharacterheightbothbythecurrentcharacterexpansionandbythelineheight
multiplier.Defaultvalueis1.Usedintextandstrheight.

ljoin

Thelinejoinstyle.Thiscanbespecifiedasanintegerorstring:

and"round"meanroundedlinejoins[default]

and"mitre"meanmitredlinejoins

and"bevel"meanbevelledlinejoins.

lmitre

Thelinemitrelimit.Thiscontrolswhenmitredlinejoinsareautomaticallyconvertedintobevelledline
joins.Thevaluemustbelargerthan1andthedefaultis10.Notalldeviceswillhonourthissetting.

lty

Thelinetype.Linetypescaneitherbespecifiedasaninteger(0=blank,1=solid(default),2=dashed,
3=dotted,4=dotdash,5=longdash,6=twodash)orasoneofthecharacterstrings"blank","solid",
"dashed","dotted","dotdash","longdash",or"twodash",where"blank"usesinvisiblelines(i.e.,
doesnotdrawthem).

Alternatively,astringofupto8characters(fromc(1:9,"A":"F"))maybegiven,givingthelengthof
linesegmentswhicharealternativelydrawnandskipped.SeesectionLineTypeSpecification.

Functionssuchaslinesandsegmentsacceptavectorofvalueswhicharerecycled.

lwd

Thelinewidth,apositivenumber,defaultingto1.Theinterpretationisdevicespecific,andsome
devicesdonotimplementlinewidthslessthanone.(Seethehelponthedevicefordetailsofthe
interpretation.)

Functionssuchaslinesandsegmentsacceptavectorofvalueswhicharerecycled:insuchuseslines
correspondingtovaluesNAorNaNareomitted.Theinterpretationof0isdevicespecific.

mai

Anumericalvectoroftheformc(bottom,left,top,right)whichgivesthemarginsizespecifiedin
inches.

http://127.0.0.1:15529/library/graphics/html/par.html 6/12
21/10/2016 R:SetorQueryGraphicalParameters

mar

Anumericalvectoroftheformc(bottom,left,top,right)whichgivesthenumberoflinesof
margintobespecifiedonthefoursidesoftheplot.Thedefaultisc(5,4,4,2)+0.1.

mex

mexisacharactersizeexpansionfactorwhichisusedtodescribecoordinatesinthemarginsofplots.
Notethatthisdoesnotchangethefontsize,ratherspecifiesthesizeoffont(asamultipleofcsi)used
toconvertbetweenmarandmai,andbetweenomaandomi.

Thisstartsas1whenthedeviceisopened,andisresetwhenthelayoutischanged(alongsideresetting
cex).

mfcol,mfrow

Avectoroftheformc(nr,nc).Subsequentfigureswillbedrawninannrbyncarrayonthedevice
bycolumns(mfcol),orrows(mfrow),respectively.

Inalayoutwithexactlytworowsandcolumnsthebasevalueof"cex"isreducedbyafactorof0.83:if
therearethreeormoreofeitherrowsorcolumns,thereductionfactoris0.66.

Settingalayoutresetsthebasevalueofcexandthatofmexto1.

Ifeitheroftheseisquerieditwillgivethecurrentlayout,soqueryingcannottellyoutheorderin
whichthearraywillbefilled.

Considerthealternatives,layoutandsplit.screen.

mfg

Anumericalvectoroftheformc(i,j)whereiandjindicatewhichfigureinanarrayoffiguresisto
bedrawnnext(ifsetting)orisbeingdrawn(ifenquiring).Thearraymustalreadyhavebeensetby
mfcolormfrow.

ForcompatibilitywithS,theformc(i,j,nr,nc)isalsoaccepted,whennrandncshouldbethe
currentnumberofrowsandnumberofcolumns.Mismatcheswillbeignored,withawarning.

mgp

Themarginline(inmexunits)fortheaxistitle,axislabelsandaxisline.Notethatmgp[1]affectstitle
whereasmgp[2:3]affectaxis.Thedefaultisc(3,1,0).

mkh

http://127.0.0.1:15529/library/graphics/html/par.html 7/12
21/10/2016 R:SetorQueryGraphicalParameters

Theheightininchesofsymbolstobedrawnwhenthevalueofpchisaninteger.Completelyignoredin
R.

new

logical,defaultingtoFALSE.IfsettoTRUE,thenexthighlevelplottingcommand(actuallyplot.new)
shouldnotcleantheframebeforedrawingasifitwereonanewdevice.Itisanerror(ignoredwitha
warning)totrytousenew=TRUEonadevicethatdoesnotcurrentlycontainahighlevelplot.

oma

Avectoroftheformc(bottom,left,top,right)givingthesizeoftheoutermarginsinlinesoftext.

omd

Avectoroftheformc(x1,x2,y1,y2)givingtheregioninsideoutermarginsinNDC(=normalized
devicecoordinates),i.e.,asafraction(in[0,1])ofthedeviceregion.

omi

Avectoroftheformc(bottom,left,top,right)givingthesizeoftheoutermarginsininches.

page

R.O.Abooleanvalueindicatingwhetherthenextcalltoplot.newisgoingtostartanewpage.This
valuemaybeFALSEiftherearemultiplefiguresonthepage.

pch

Eitheranintegerspecifyingasymbolorasinglecharactertobeusedasthedefaultinplottingpoints.
Seepointsforpossiblevaluesandtheirinterpretation.Notethatonlyintegersandsinglecharacter
stringscanbesetasagraphicsparameter(andnotNAnorNULL).

Somefunctionssuchaspointsacceptavectorofvalueswhicharerecycled.

pin

Thecurrentplotdimensions,(width,height),ininches.

plt

Avectoroftheformc(x1,x2,y1,y2)givingthecoordinatesoftheplotregionasfractionsofthe
currentfigureregion.

ps

integerthepointsizeoftext(butnotsymbols).Unlikethepointsizeargumentofmostdevices,this
doesnotchangetherelationshipbetweenmarandmai(noromaandomi).
http://127.0.0.1:15529/library/graphics/html/par.html 8/12
21/10/2016 R:SetorQueryGraphicalParameters

Whatismeantbypointsizeisdevicespecific,butmostdevicesmeanamultipleof1bp,thatis1/72
ofaninch.

pty

Acharacterspecifyingthetypeofplotregiontobeused"s"generatesasquareplottingregionand
"m"generatesthemaximalplottingregion.

smo

(Unimplemented)avaluewhichindicateshowsmoothcirclesandcirculararcsshouldbe.

srt

Thestringrotationindegrees.Seethecommentaboutcrt.Onlysupportedbytext.

tck

Thelengthoftickmarksasafractionofthesmallerofthewidthorheightoftheplottingregion.Iftck
>=0.5itisinterpretedasafractionoftherelevantside,soiftck=1gridlinesaredrawn.Thedefault
setting(tck=NA)istousetcl=0.5.

tcl

Thelengthoftickmarksasafractionoftheheightofalineoftext.Thedefaultvalueis0.5setting
tcl=NAsetstck=0.01whichisS'default.

usr

Avectoroftheformc(x1,x2,y1,y2)givingtheextremesoftheusercoordinatesoftheplotting
region.Whenalogarithmicscaleisinuse(i.e.,par("xlog")istrue,seebelow),thenthexlimitswill
be10^par("usr")[1:2].Similarlyfortheyaxis.

xaxp

Avectoroftheformc(x1,x2,n)givingthecoordinatesoftheextremetickmarksandthenumberof
intervalsbetweentickmarkswhenpar("xlog")isfalse.Otherwise,whenlogcoordinatesareactive,
thethreevalueshaveadifferentmeaning:Forasmallrange,nisnegative,andtheticksareasinthe
linearcase,otherwise,nisin1:3,specifyingacasenumber,andx1andx2arethelowestandhighest
powerof10insidetheusercoordinates,10^par("usr")[1:2].(The"usr"coordinatesarelog10
transformedhere!)

n=1

willproducetickmarksat10^jforintegerj,

n=2

givesmarksk10^jwithkin{1,5},

n=3

givesmarksk10^jwithkin{1,2,5}.

SeeaxTicks()forapureRimplementationofthis.

Thisparameterisresetwhenausercoordinatesystemissetup,forexamplebystartinganewpageor
bycallingplot.windoworsettingpar("usr"):nistakenfrompar("lab").Itaffectsthedefault
behaviourofsubsequentcallstoaxisforsides1or3.

http://127.0.0.1:15529/library/graphics/html/par.html 9/12
21/10/2016 R:SetorQueryGraphicalParameters

Itisonlyrelevanttodefaultnumericaxissystems,andnotforexampletodates.

xaxs

Thestyleofaxisintervalcalculationtobeusedforthexaxis.Possiblevaluesare"r","i","e","s",
"d".Thestylesaregenerallycontrolledbytherangeofdataorxlim,ifgiven.
Style"r"(regular)firstextendsthedatarangeby4percentateachendandthenfindsanaxiswith
prettylabelsthatfitswithintheextendedrange.
Style"i"(internal)justfindsanaxiswithprettylabelsthatfitswithintheoriginaldatarange.
Style"s"(standard)findsanaxiswithprettylabelswithinwhichtheoriginaldatarangefits.
Style"e"(extended)islikestyle"s",exceptthatitisalsoensuresthatthereisroomforplotting
symbolswithintheboundingbox.
Style"d"(direct)specifiesthatthecurrentaxisshouldbeusedonsubsequentplots.
(Only"r"and"i"styleshavebeenimplementedinR.)

xaxt

Acharacterwhichspecifiesthexaxistype.Specifying"n"suppressesplottingoftheaxis.The
standardvalueis"s":forcompatibilitywithSvalues"l"and"t"areacceptedbutareequivalentto
"s":anyvalueotherthan"n"impliesplotting.

xlog

Alogicalvalue(seeloginplot.default).IfTRUE,alogarithmicscaleisinuse(e.g.,afterplot(*,log
="x")).Foranewdevice,itdefaultstoFALSE,i.e.,linearscale.

xpd

AlogicalvalueorNA.IfFALSE,allplottingisclippedtotheplotregion,ifTRUE,allplottingisclippedto
thefigureregion,andifNA,allplottingisclippedtothedeviceregion.Seealsoclip.

yaxp

Avectoroftheformc(y1,y2,n)givingthecoordinatesoftheextremetickmarksandthenumberof
intervalsbetweentickmarksunlessforlogcoordinates,seexaxpabove.

yaxs

Thestyleofaxisintervalcalculationtobeusedfortheyaxis.Seexaxsabove.

yaxt

Acharacterwhichspecifiestheyaxistype.Specifying"n"suppressesplotting.

ylbias

Apositiverealvalueusedinthepositioningoftextinthemarginsbyaxisandmtext.Thedefaultisin
principledevicespecific,butcurrently0.2forallofR'sowndevices.Setthisto0.2forcompatibility
withR<2.14.0onx11andwindows()devices.

ylog

Alogicalvalueseexlogabove.

ColorSpecification

Colorscanbespecifiedinseveraldifferentways.Thesimplestwayiswithacharacterstringgivingthecolor
name(e.g.,"red").Alistofthepossiblecolorscanbeobtainedwiththefunction colors.Alternatively,
colorscanbespecifieddirectlyintermsoftheirRGBcomponentswithastringoftheform"#RRGGBB"where
eachofthepairsRR,GG,BBconsistoftwohexadecimaldigitsgivingavalueintherange00toFF.Colorscan
http://127.0.0.1:15529/library/graphics/html/par.html 10/12
21/10/2016 R:SetorQueryGraphicalParameters

alsobespecifiedbygivinganindexintoasmalltableofcolors,thepalette:indiceswraproundsowiththe
defaultpaletteofsize8,10isthesameas2.ThisprovidescompatibilitywithS.Index0correspondstothe
backgroundcolor.Notethatthepalette(apartfrom0whichisperdevice)isapersessionsetting.

Negativeintegercoloursareerrors.

Additionally,"transparent"istransparent,usefulforfilledareas(suchasthebackground!),andjust
invisibleforthingslikelinesortext.Inmostcircumstances(integer)NAisequivalentto"transparent"(but
notfortextandmtext).

Semitransparentcolorsareavailableforuseondevicesthatsupportthem.

Thefunctionsrgb,hsv,hcl,grayandrainbowprovideadditionalwaysofgeneratingcolors.

LineTypeSpecification

Linetypescaneitherbespecifiedbygivinganindexintoasmallbuiltintableoflinetypes(1=solid,2=
dashed,etc,seeltyabove)ordirectlyasthelengthsofon/offstretchesofline.Thisisdonewithastringof
anevennumber(uptoeight)ofcharacters,namelynonzero(hexadecimal)digitswhichgivethelengthsin
consecutivepositionsinthestring.Forexample,thestring"33"specifiesthreeunitsonfollowedbythreeoff
and"3313"specifiesthreeunitsonfollowedbythreeofffollowedbyoneonandfinallythreeoff.Theunits
hereare(onmostdevices)proportionaltolwd,andwithlwd=1areinpixelsorpointsor1/96inch.

Thefivestandarddashdotlinetypes(lty=2:6)correspondtoc("44","13","1343","73","2262").

NotethatNAisnotavalidvalueforlty.

Note

Theeffectofrestoringallthe(settable)graphicsparametersasintheexamplesishardtopredictifthedevice
hasbeenresized.Severalofthemareattemptingtosetthesamethingsindifferentways,andthoselastinthe
alphabetwillwin.Inparticular,thesettingsofmai,mar,pin,pltandptyinteract,asdotheoutermargin
settings,thefigurelayoutandfigureregionsize.

References

Becker,R.A.,Chambers,J.M.andWilks,A.R.(1988)TheNewSLanguage.Wadsworth&Brooks/Cole.

Murrell,P.(2005)RGraphics.Chapman&Hall/CRCPress.

SeeAlso

plot.defaultforsomehighlevelplottingparameterscolorsclipoptionsforothersetupparameters
graphicdevicesx11,postscriptandsettingupdeviceregionsbylayoutandsplit.screen.

Examples

op<par(mfrow=c(2,2),#2x2picturesononeplot
pty="s")#squareplottingregion,
#independentofdevicesize

##Atendofplotting,resettoprevioussettings:
par(op)

##Alternatively,
op<par(no.readonly=TRUE)#thewholelistofsettablepar's.
##dolotsofplottingandpar(.)calls,thenreset:
par(op)
##Notethisisnotingeneralgoodpractice

par("ylog")#FALSE
plot(1:12,log="y")
http://127.0.0.1:15529/library/graphics/html/par.html 11/12
21/10/2016 R:SetorQueryGraphicalParameters

par("ylog")#TRUE

plot(1:2,xaxs="i")#'inneraxis'w/oextraspace
par(c("usr","xaxp"))

(nr.prof<
c(prof.pilots=16,lawyers=11,farmers=10,salesmen=9,physicians=9,
mechanics=6,policemen=6,managers=6,engineers=5,teachers=4,
housewives=3,students=3,armed.forces=1))
par(las=3)
barplot(rbind(nr.prof))#R0.63.2:showsalignmentproblem
par(las=0)#resettodefault

require(grDevices)#forgray
##'fg'use:
plot(1:12,type="b",main="'fg':axes,ticksandboxingray",
fg=gray(0.7),bty="7",sub=R.version.string)

ex<function(){
old.par<par(no.readonly=TRUE)#allparsettingswhich
#couldbechanged.
on.exit(par(old.par))
##...
##...dolotsofpar()settingsandplots
##...
invisible()#now,par(old.par)willbeexecuted
}
ex()

##Linetypes
showLty<function(ltys,xoff=0,...){
stopifnot((n<length(ltys))>=1)
op<par(mar=rep(.5,4));on.exit(par(op))
plot(0:1,0:1,type="n",axes=FALSE,ann=FALSE)
y<(n:1)/(n+1)
clty<as.character(ltys)
mytext<function(x,y,txt)
text(x,y,txt,adj=c(0,.3),cex=0.8,...)
abline(h=y,lty=ltys,...);mytext(xoff,y,clty)
y<y1/(3*(n+1))
abline(h=y,lty=ltys,lwd=2,...)
mytext(1/8+xoff,y,paste(clty,"lwd=2"))
}
showLty(c("solid","dashed","dotted","dotdash","longdash","twodash"))
par(new=TRUE)#thesame:
showLty(c("solid","44","13","1343","73","2262"),xoff=.2,col=2)
showLty(c("11","22","33","44","12","13","14","21","31"))

[Packagegraphicsversion3.3.1Index]

http://127.0.0.1:15529/library/graphics/html/par.html 12/12

Você também pode gostar