Question: Placing labels in the plot

0

akang •

**90**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{....
}
```

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

3.5kThank'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..

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

39kI 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

90