[R] legend placement

Duncan Murdoch murdoch at stats.uwo.ca
Thu Apr 10 13:07:37 CEST 2008


Ng Stanley wrote:
> Hi,
>
> I am plotting 5 charts using p <- par(mfrow = c(3, 2), how can I place my
> legend in the last region ? I don't wan to put it into the margin.

You should be able to do a blank plot, then plot the legend.  For example,

 > par(mfrow=c(3,2))
 > for (i in 1:5) plot(1)
 > plot(1, axes=F, xlab="", ylab="", type="n")
 > legend("center", pch=1, legend="points")


Duncan Murdoch



More information about the R-help mailing list