[R] Labeling lines in xyplot
John Poulsen
jpoulsen at zoo.ufl.edu
Tue Aug 5 20:15:33 CEST 2008
Hello,
I apologize in advance as this example seems really elementary. Below I
have created a simple scatterplot with lines. I would like to label
each line with the name of the village, instead of using a legend. Can
someone please let me know how to do it.
Thanks in advance -- John
Pop=c(1406,1862,2333,2664,2685,2521,2726,0,0,0,0,214,289,365,900,952,1002,1205,1041,942,1004,
616,806,859,991,865,810,399,7200,9136,11389,12634,13114,13417,12670)
Villages=rep(c("Kabo", "Loundoungou", "Ndoki 1", "Ndoki 2",
"Pokola"),each=7)
Year=rep(c(2000,2001,2002,2003,2004,2005,2006),7)
xyplot(Pop~Year, groups=Villages,type="b",
main="Population of logging villages",
xlab=list(expression("Years"),cex=1.2),
ylab=list(expression("Number of people"),cex=1.2),
lwd=2,lty=c(1,2,3,4,5,6),col=c(1,8,8,1,8),pch=1:5,
scales=list(tick.number=6, tck=c(1,0)))
More information about the R-help
mailing list