Hi, I am looking forward to fill the plot using conditions on variables a2 and a3. Whenever variable(a2) goes above variable(a3) i fill it with some color .
I am storing the coordinates of a2 and a3 in x and y as well as time where it is occurring . But it is not producing properly. I must be wrong in assigning coordinates. What should be the correct way to produce the desired plot? Thanks in advance ###################################################################################################### x<-vector() y<-vector() temp_time<-vector() for(i in 1:length) { if(a2[i]>a3[i]) { j<-j+1 x[j]<-a2[i] y[j]<-a3[j] temp_time<-time[i] } } time<-q[,1] a2<-q[,3] a3<-q[,4] plot(time,a2type='l',col='red',ylab='',xlab=" ",axes=FALSE) lines(time,a3,col='blue',ylab='',xlab=" ") polygon(c(time[1:j],time[1:j]),c(x,y),col="grey") ######################################################################################################### -- Avinash Barnwal Final year undergraduate student Statistics and informatics Department of Mathematics IIT Kharagpur [[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.