Question: Placing labels in the plot
0
gravatar for akang
2.9 years ago by
akang90
akang90 wrote:

Hi all! I made an admixture plot and now i want to place the population names along the x-axis of the plot. I want to place the labels in he centre of the number of samples that belong to a particular population. If I have 5 populations with sample size 10, 20,20,35,100 then label should be at 10/2 for population 1, 20/2 for population 2 and so on. I tried the following but it doesnt work. Ill appreciate any further help!

pop<-c("pop1", "pop2", "pop3", "pop4", "pop5")
n<-c(10, 20,20,35,100)
at <- n/2
barplot(t(as.matrix(tbl)),col=rainbow(5),width=1,space=1)
mtext(1,at=at,text=pop,cex=1, las=2)
for{....
}
plot admixture label R • 1.4k views
ADD COMMENTlink written 2.9 years ago by akang90

See this post, it may help

ADMIXTURE and R, color meaning on barplot in studing population ancestry, K value

See also this link:

https://github.com/mkanai/cancritls/blob/master/admixture/admixture.plot.r

The guide looks useful too:

https://cran.r-project.org/web/packages/admixturegraph/vignettes/admixturegraph.html

Or these examples:

http://www.statmethods.net/advgraphs/axes.html

ADD REPLYlink modified 2.9 years ago • written 2.9 years ago by natasha.sernova3.5k

Thank's Natasha! In my case all what i am looking for is to place my labels with respect to my populations and their sample size..

ADD REPLYlink written 2.9 years ago by akang90

Could you show us what you have and what you would like to have? An example?

ADD REPLYlink written 2.9 years ago by WouterDeCoster39k

I have a plot like this(without the labels on X-axis)..http://journals.plos.org/plosgenetics/article/figure/image?size=medium&id=info:doi/10.1371/journal.pgen.1004254.g006 To a barplot like this i want to add population labels(Like how you see in the plot). For plotting without population labels i did this but i dont know how to put population labels. Each row corresponds to each sample in the population. There are ~500 total samples belonging to 5 different populations. Each population has different number of samples. Example Input file is like below

test.5.Q
0.364957    0.00001 1.00E-05    0.00001 1.00E-05
0.485423    0.017426    1.00E-05    0.00001 1.00E-05
0.399289    0.00001 1.00E-05    0.002894    1.00E-05
0.579652    0.00001 1.00E-05    0.00001 1.00E-05
0.578574    0.00001 1.00E-05    0.00001 1.00E-05
0.597478    0.00001 1.00E-05    0.00001 1.00E-05
> tbl=read.table("test.5.Q")
> barplot(t(as.matrix(tbl)), col=rainbow(3),xlab="Individual #", ylab="Ancestry", border=NA)
ADD REPLYlink written 2.9 years ago by akang90
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1546 users visited in the last hour