Hello,

I am trying to plot ADMIXTURE output in R. My output is two-dimensional
(two columns, 190 rows). These rows represent individuals, and groups of
them (e.g., 1-12) represent populations. What I'm hoping for is a plot with
eleven different colours, basically like a STRUCTURE plot.

#This code works, but plots with only two colours, not separating the
populations
#to show you how I'm reading in my data
tbl=read.table("filepath to file",sep=" ")

#plotting

barplot(t(as.matrix(tbl)), col=rainbow(4), xlab="Individual #",
ylab="Ancestry", border=NA)

###I have tried to amend this with the following code:

barplot(t(as.matrix(tbl[c(0:12, 13:32, 33:51, 52:69, 70:87, 88:104,
105:118, 119:137, 138:157, 158:172, 173:190), ])), col=c("darkgreen",
"darkblue", "orange", "cyan", "yellow", "chartreuse", "blue", "cyan4",
"red", "violet", "blueviolet"), xlab="Individual #", ylab="Ancestry",
border=NA)

#but this code really still says the same thing as the first, i.e., c(1:190)

###Alternatively, this code separates the colours

barplot(t(as.matrix(tbl))[1], col=c("darkgreen", "darkblue", "orange",
"cyan", "yellow", "chartreuse", "blue", "cyan4", "red", "violet",
"blueviolet") [c(rep(1,length(1:12)),rep(2,length(13:32)),
rep(3,length(33:51)), rep(4,length(52:69)), rep(5,length(70:87)),
rep(6,length(88:104)), rep(7,length(105:118)), rep(8,length(119:137)),
rep(9,length(138:157)), rep(10,length(158:172)), rep(11,length(173:190)))],
xlab="Individual #", ylab="Ancestry", border=NA)

#But this only plots in one dimension. I've tried so many permutations of
the concepts in each of these, and I just can't get it.

I've tried available code on the net, but I think my R skills aren't
advanced enough to sort out their tricks. Any suggestions would be much
appreciated.

Sincerely, Ella

-- 
Ella Bowles
PhD Candidate
Biological Sciences
University of Calgary

e-mail: ebow...@ucalgary.ca, bowl...@gmail.com
website: http://ellabowlesphd.wordpress.com/

        [[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.

Reply via email to