[R] key in margin area
Adaikalavan Ramasamy
gisar at nus.edu.sg
Tue Jan 21 04:45:03 CET 2003
Well, if you don't want to play with the margins, then I guess you have
to use the layout() function. You will want something similar to the
following if you want legends at the right:
def.par <- par(no.readonly = TRUE)# save default
nf <- layout( matrix( c(1,2), nrow=1), c(4,1) ) # If you want legend at
bottom, change nrow to ncol
layout.show(nf) # so the ratio of plot to legend area is 4:1
par(mar=c(1,1,1,1))
plot.new() # calls an empty plot
legend( 0, 0.5, "A spot", pch=1, col=1)
par(def.par) # reset to default
There might be a nicer way of doing this though.
-----Original Message-----
From: Jeremy Z Butler [mailto:jerrytheshrub at hotmail.com]
Sent: Tuesday, January 21, 2003 11:17 AM
To: r-help at stat.math.ethz.ch
Subject: [R] key in margin area
Hi
Is there any way to position a key (legend) outside the plot area? i.e.
in
the margin between plot area and page margin. I realise I could achieve
the
same effect by creating a larger plot but not printing the axes and then
draw the smaller axes independantly leaving room for the key. However,
that
wont work very well in my particular case.
Thanks in advance
Jeremy
______________________________________________
R-help at stat.math.ethz.ch mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help
More information about the R-help
mailing list