[R] legend outside plot area

Pete B Peter.Brecknock at bp.com
Sun Aug 15 15:46:26 CEST 2010


Emily

Maybe this will help

# Data
y1=rnorm(10)
y2=runif(10)
x=1:10

# Set XPD and Outer Margin
par(xpd=NA,oma=c(3,0,0,0))

# Plot and Legend
plot(x,y1,type="n",ylab="")
lines(x,y1, col="red")
lines(x,y2, col="blue")
legend(par("usr")[1],par("usr")[3],c("Y1","Y2"),col=c("red","blue"),lty=1,xjust=0,
yjust=2.0)


Kind regards

Pete
-- 
View this message in context: http://r.789695.n4.nabble.com/legend-outside-plot-area-tp2325864p2325938.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list