[R] legend help

casperyc casperyc at hotmail.co.uk
Thu Feb 4 00:54:17 CET 2010


i=1
for(rate in c(2,4) ){
	for(shape in c(1,3,5) ){
	curve(dgamma(x,rate,shape),xlim=c(0,3),ylab="",col=i,lty=i,add=T)
	i=i+1
	}
}

How can I add some legend to represent these lines?
i.e. the legend is displayed as

col=1 lty=1 lambda=2 theta=1
col=2 lty=2 lambda=2 theta=3
col=3 lty=3 lambda=2 theta=5
col=4 lty=4 lambda=4 theta=1
col=5 lty=5 lambda=4 theta=3
col=6 lty=6 lambda=4 theta=5

i tried to use
legend( locator(1), expression(lambda=i theta=i),col=i,lty=i)
but did actually get it

can someone help?

Thanks!

casper
-- 
View this message in context: http://n4.nabble.com/legend-help-tp1461992p1461992.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list