[R] Handling of par() with variables
Steffen Uhlig
steffen.uhlig at htw-saarland.de
Fri Jun 4 11:40:55 CEST 2010
Hello!
In order to plot multiple graphs with the same setup I use the
following code-structure:
###########################################################
# storing old parameter set
oldpar <- par(no.readonly=T)
#copying old parameter set
newpar <- par(no.readonly=T)
#adjusting parameters
newpar <- par(mar=c(3.1,3.1,0.1,0.1), # margin for figure area
oma=c(0,0,0,0), # margin for outer figure area
cex.axis=0.9, # font size axis
mgp=c(2,0.6,0), # distance of axis
tck=0.02 # major ticks inside
)
...
...
postscript(...)
par(newpar)
...
dev.off()
###########################################################
Calling the variable newpar delivers the old paramter set only (from
code-line "newpar <- par(no.readonly=T)"). If the code-segment "newpar
<- par(mar=..." runs a second time, the correct paramter set is
stored, however, just the 5 parameters adjusted and not the full list.
My question is, why must the code segment "newpar<-par(mar...)" run
twice? Is there a better way to handle the graphics output? I would be
grateful for a pointer on a FAQ-section or to an older discussion
thread in this group!
Thank you very much in advance!
Regards,
/steffen
--
Steffen Uhlig, PhD
Mechatronik und Sensortechnik
HTW des Saarlandes
Goebenstraße 40
66117 Saarbrücken
Tel.: +49 (0) 681 58 67 274
More information about the R-help
mailing list