RE: [R] key in margin area

About this list Date view Thread view Subject view Author view Attachment view

From: Adaikalavan Ramasamy (gisar@nus.edu.sg)
Date: Tue 21 Jan 2003 - 14:43:54 EST


Message-id: <024D6AEFCB92CB47BA1085751D184BB80105F1F2@MBXSRV03.stf.nus.edu.sg>

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@hotmail.com]
Sent: Tuesday, January 21, 2003 11:17 AM
To: r-help@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

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.

______________________________________________
R-help@stat.math.ethz.ch mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

______________________________________________
R-help@stat.math.ethz.ch mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Tue 01 Jul 2003 - 09:11:19 EST