Henrik Andersson wrote:
Assume I want to put this into a function, how do I redefine the margins
to fit better.
I did par(mar=c(4.1,4.1,5.1,2.1) inside the function, but then it is not
possible anymore to change them, I just want to change the default for
this plotting function, how ?
You can save the old par values and restore them
after creating your plot.
# reset par values, saving the old ones
oldpar = par(mar=c(4.1,4.1,5.1,2.1))
# create stunning customized plot here
# restore the old par values
par(oldpar)
When embedding this in a function like yours it is better
to use the on.exit() function to restore the old values.
f = function(...) {
oldpar = par(mar=c(4.1,4.1,5.1,2.1))
on.exit(par(oldpar))
# create stunning customized plot here
}
Error exits from the function will then also restore the old
par values.
--
Ross Ihaka Email: [EMAIL PROTECTED]
Department of Statistics Phone: (64-9) 373-7599 x 85054
University of Auckland Fax: (64-9) 373-7018
Private Bag 92019, Auckland
New Zealand
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html