====== Haplotype frequencies in population ====== * file: lines_HaplotypeFreqMultiple.r * document page: 29 \\ **code:** #----read data------------------------------------------------------------------ Names <- scan("D:/Heidi/Master/R_Daten/SummaryStatistics/haplotype_frequ.txt", what="list", skip=5, nlines=1) Data <- read.table("D:/Heidi/Master/R_Daten/SummaryStatistics/haplotype_frequ.txt", skip=8) nRow <- nrow(Data) nCol <- ncol(Data) #----draw plot------------------------------------------------------------------ x <- 1 plot(Data[,(x+1)], type="l", xlab="Haplotype", ylab="Haplotype frequency", main="Haplotype frequencies in populations", ylim=c(0,1), xaxt="n", col=(x), lwd=1 ) x <- x + 1 while(x <= nCol){ lines(Data[,(x+1)], col=(x), lwd=1, lty=(x/9)+1 ) x <- x + 1 } axis(1, at=c(1:nRow), labels=Data[,1], cex.axis=0.8) legend("topright", legend=c("Population:", Names[2:length(Names)]), lty=c(0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2), bty="n", col=c(0:x), lwd=1.5)