Question: Placing labels in the plot
gravatar for akang
2.9 years ago by
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
mtext(1,at=at,text=pop,cex=1, las=2)
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:

The guide looks useful too:

Or these examples:

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

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.


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