Hi put line
legend("topright", legend=names(a)[3:9], lty=1, col=3:9) before dev.off() see ?legend for fine tuning. Regards Petr > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Ma Teresa Martinez Soriano > Sent: Tuesday, September 03, 2013 10:59 AM > To: r-help@r-project.org > Subject: [R] Legend Help > > Hi to everyone and thanks for this service. > > I have a doubt with legend, I have seen ?legend, but I don't get the > way to write in my code the > > legend that I want, > > This is my code: > > > > for( i in 1:4)} > > pdf(paste("plotImputed", i,".pdf",sep="")) > plot(a[,6], type="l", main=paste( "Imputed Data GRUPO",i) ) > for(k in 3:9)(lines(a[, k], type="l", col=k)) > dev.off() > > } > > > Each line represent a column of my data set, they are called: IE.2004, > IE.2006, IE.2007....IE.2010 and this is (IE.2005, IE.2006...) > > what I would like to see in the graph > > Thanks a lot > > Best regards, Teresa > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.