[R] Setting the 'fig' graphic parameter

Mario dos Reis mario.reis at ucl.ac.uk
Mon Mar 22 17:22:51 CET 2004


Hi guys,

# I would like to plot a figure with the following layout:
#
#  ----------------------------
#  |                 |        |
#  |                 |        |
#  |                 |        |
#  |                 |--------|
#  |                 |        |
#  |                 |        |
#  |                 |        |
#  ----------------------------

x <- rnorm(100)
y <- rnorm(100)

par(fig=c(0,0.7,0,1))
plot(x,y)

# (please maximise your plotting device so you get a 'rectangular' area)

# now lets do the upper corner 'little' plot

par(fig=c(0.7, 1, 0.5, 1))
plot(x,y)

# and ...

par(fig=c(0.7, 1, 0, 0.5))
plot(x,y)

Now, my problem is as you might have seen already, that the old figure
gets deleted when the new one is placed. I was trying to reproduce an
exercise a saw in an S-plus book. I would really like to know what is
going on, the documentation about graphic parameters is not very helpful
about fig, and I would really like to set a graph with the above layout.

Thanks,
Mario dos Reis.




More information about the R-help mailing list