[R] Overall Legend

From: Juned Siddique <siddique_at_ucla.edu>
Date: Tue 16 Aug 2005 - 10:47:32 EST


Hello. I am using R version 2.1.1 on Windows 2000.

I am using a par(mfrow=c(2,2)) statement to produce 4 plots on one screen. I want a single horizontal legend to appear at the top of the four plots. My code is something like this:

par(mfrow=c(2,2))

plot(x,y1)
lines(x,y2)
lines(x,y3)

plot(x,z1)
lines(x,z2)
lines(x,z3)

plot(x,t1)
lines(x,t2)
lines(x,t3)

plot(x,w1)
lines(x,w2)
lines(x,w3)

Instead of the statement:
legend(x="right", c("Bias Squared","Variance","Mean Squared Error"), lty=c(2,1,3), col=c("green","blue","red"), lwd="2",cex=0.5,inset = 0.05)

appearing within each plot, I would like it to appear at the top of the graph because it applies to all four plots. Any help would be appreciated. Thank you.

-Juned

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Aug 16 10:54:11 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:49 EST