Hi all, I am new to R programming and I was trying to write a simple code in order to plot my data. The problem is that I am not able to insert a legend corresponding to each column of the data matrix. Please can someone help me out. How can i directly get the legend relating to each data curve. This is the code I had written: matrix<-read.table(file="PNPLA.txt", header=TRUE, sep="\t", row.names=1 ) a<-matrix[1:6] c1<-a[,1]/a[28,1] c2<-a[,2]/a[28,2] c3<-a[,3]/a[28,3] c4<-a[,4]/a[28,4] c5<-a[,5]/a[28,5] c6<-a[,6]/a[28,6] mat<-cbind(c1,c2,c3,c4,c5,c6) x1<-mat[,1]/a[,1] x2<-mat[,2]/a[,1] x3<-mat[,3]/a[,1] x4<-mat[,4]/a[,1] x5<-mat[,5]/a[,1] x6<-mat[,6]/a[,1] final<-cbind(x1,x2,x3,x4,x5,x6) matplot(final,type="l") tfin<-t(final) colnames(tfin)<-c("PC26","PC28","PC28:02","PC30","PC32","PC3201","PC3202","PC34", "PC3401","PC3402","PC3404","PC36","PC3601","PC3602","PC3604","PC3606","PC38","PC3804","PC3806","PC40","PC4002","PC4006","PC4008","PC42","PC44","SM21") matplot(tfin,pch = 1:25, type "o",lty=20,lwd=1.9,xlab="Time",ylab="PCmix/SM21:00 ratio") -- View this message in context: http://r.789695.n4.nabble.com/adding-legend-to-matplot-tp3489844p3489844.html Sent from the R help mailing list archive at Nabble.com.