[R] "legend" question

Sarah Goslee sarah.goslee at gmail.com
Fri Feb 19 20:45:23 CET 2010


I still can't tell exactly what you want, but maybe something like this?

> legend(30,0.08, c("Normal density","Kernel density"),col=c("red","blue"),lty=1:1,lwd=1:1,bty="n")
> legend(30,0.06, c(paste("Mean =",round(mean(CDR3),1)),paste("Median =",median(CDR3))),col=c("red","black"),pch=19:19,bty="n")
>
> I tried the code below to create one legend, but I failed:
> legend(x3,y3,
> c("Normal density","Kernel density","paste("Mean
> =",round(mean(CDR3),1)","paste("Median
> =",median(CDR3))"),c(lty=1,lty=1,pch=19,pch=19),col=c("red","blue","red","black"),bty="n")

legend(x3,y3, c("Normal density","Kernel density","paste("Mean
=",round(mean(CDR3),1)","paste("Median =",median(CDR3))"), lty=c(1, 1,
NA, NA), pch=c(NA, NA, 19, 19), col=c("red","blue","red","black"),
bty="n")

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list