pdf(file= 'Guppyplot.pdf') opar<-par(no.readonly = T) par(mfrow = c(3,2)) for (n in 1:23){ folder <- paste('LG',n,sep='') url <- paste('/Users/monica/Desktop/Project/guppy/',folder,sep='') setwd(url) readfile <- read.csv('final1.txt',sep = "\t",header = F) position <- readfile$V2 value <-(readfile$V4)*100 plot(position,value,type = 'p',col='blue',pch=20,xlab='Position on the chromosome(%)',ylab='GC content(%)',xlim=c(0,100),ylim=c(20,65),main = paste('Guppy',folder)) p<-predict(loess(value~position),col='red',se=T) lines(position,p$fit,col='red') lines(position,p$fit - qt(0.975,p$df)*p$se, lty=1,col='green') lines(position,p$fit + qt(0.975,p$df)*p$se, lty=1,col='green') setwd('/Users/monica/Desktop/Project/guppy/') } par(opar) dev.off()