[R] Plot legend in margin

Daniel Brewer daniel.brewer at icr.ac.uk
Fri Aug 10 12:55:29 CEST 2007

Thanks.  That got me onto the right track.  Because it is a multiplot
and I wanted it along the bottom, I found that I had to use par(xpd=NA)
and then position it relative to the last of the multiplots.  After a
bit of trial and error I got there.


Lauri Nikkinen wrote:
> Very simple example:
> opar <- par(mar = c(10, 4, 4, 4))
> plot(1:10)
> lines(1:10)
> par(xpd=TRUE)
> legend(4,-1.5,lty=1, col="black", legend="straigh line")
> par(opar)
> -Lauri

Daniel Brewer, Ph.D.
Institute of Cancer Research
Email: daniel.brewer at icr.ac.uk

The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the addre...{{dropped}}

More information about the R-help mailing list