Hello,

I have a function that changes par("plt") to plot a colorkey, and upon returning resets the original value.
Unfortunately this changes the size of the plots when I change the layout. A simplified example:

par(mfrow = c(1, 1))
plt <- par("plt")
# ....                              # change par(plt) and create colorkey
par(plt = plt)                # resets the default
plot(0)                          # OK
par(mfrow = c(2,2))           # change layout
plot(0)                         # figure too large; par("plt") is same as in mfrow = c(1,1))



I have now solved that by writing, after par(plt = plt) the following
par(mar = par("mar"))

as far as I can see, this only sets (in R-source-code par.c) the variable defaultPlot equal to TRUE.
This seems to work, as now par("plt") is calculated when changing the layout.
I wonder if this is a good way to do this - does it have other side-effects?

Thanks,
Karline Soetaert



	[[alternative HTML version deleted]]

