<div dir="ltr">Hi, Irina. <br>Back in September I had a similar question. Caitlin Collins wrote some codes to label individuals. If might be what you were looking for.<br><br>Message from Caitlin Collins:<br><br>If you think the individuals you are plotting are spaced far enough that
 you will be able to read labels at the individual level, one way to do 
it is to use s.label. <br>Here is an example of how to use s.label to overlap labels to a scatterplot of DAPC:<br><br><div><font color="#6aa84f">#############</font></div><div><font color="#6aa84f">## EXAMPLE ##</font></div><div><font color="#6aa84f">#############</font></div><div><font color="#0000ff">set.seed(14)</font></div><div><font color="#6aa84f"># generate a simulated dataset with 3 populations</font></div><div><font color="#0000ff">simpop <- glSim(100, 500, 5, k=3, sort.pop=TRUE)</font></div><div><font color="#6aa84f"># isolate the SNPs and the population factor</font></div><div><font color="#0000ff">snps <- as.matrix(simpop)</font></div><div><font color="#0000ff">phen <- simpop@other$ancestral.pops</font></div><div><font color="#6aa84f"># run a dapc</font></div><div><font color="#0000ff">dapc1 <- dapc(snps, phen, n.pca=20, n.da=4)</font></div><div><span style="color:rgb(106,168,79)"># create the scatter plot as before</span><font color="#0000ff"><br></font></div><div><font color="#0000ff">scatter(dapc1, cstar=0, cex=5, label=NULL)</font></div><div><font color="#6aa84f"># change graphical parameter to subsequently overlay the labels without drawing a new plot</font></div><div><font color="#0000ff">par(new=TRUE)</font></div><div><font color="#6aa84f"># make a data frame of the dapc coordinates used in scatter</font></div><div><font color="#0000ff">df <- data.frame(x = dapc1$ind.coord[,1], y = dapc1$ind.coord[,2])</font></div><div><font color="#6aa84f"># identify/ create a vector of names for the individuals in your plot</font></div><div><font color="#0000ff">noms <- paste("ind", c(1:100), sep=".")</font></div><div><font color="#6aa84f"># use the text function to add labels to the positions given by the coordinates you used in plot</font></div><div><font color="#0000ff">s.label(dfxy = df, xax=1, yax=2, label=noms, </font></div><div>        <font color="#0000ff">clabel=0.7, </font><font color="#6aa84f"># change the size of the labels</font></div><div>        <font color="#0000ff">boxes=TRUE,</font> <font color="#6aa84f"># if points are spaced wide enough, can use TRUE to add boxes around the labels</font></div><div>        <font color="#0000ff">grid=FALSE, addaxes=FALSE)</font> <font color="#6aa84f"># do not draw lines or axes in addition to the labels</font></div><div><br></div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 25, 2015 at 5:53 AM, Jombart, Thibaut <span dir="ltr"><<a href="mailto:t.jombart@imperial.ac.uk" target="_blank">t.jombart@imperial.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt"><br>
<div><font>Hello, <br>
<br>
so I had understood the question, and given you the answer - use the 'pop' argument in ?scatter.dapc.<br>
<br>
Cheers<br>
Thibaut<br>
</font></div>
<div style="font-family:Times New Roman;color:#000000;font-size:16px">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma"><b>From:</b> Irina Ilyushkina [<a href="mailto:Irina.Ilyushkina@vuw.ac.nz" target="_blank">Irina.Ilyushkina@vuw.ac.nz</a>]<br>
<b>Sent:</b> 24 February 2015 22:42<br>
<b>To:</b> Jombart, Thibaut<br>
<b>Subject:</b> RE: scatter plot problem<br>
</font><br>
</div>
<div></div>
<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">I'm sorry for double posting but I'm afraid my Outlook might have failed to include the images in the e-mail.
<div><br>
</div>
<div><span style="font-size:13.3333330154419px;background-color:rgb(255,255,255)">Hi,</span>
<div style="font-size:13.3333330154419px;background-color:rgb(255,255,255)"><br>
</div>
<div style="font-size:13.3333330154419px;background-color:rgb(255,255,255)">Thank you very much for the reply! I'm sorry I didn't explain everything clearer. Initially I have 2 populations and they form 3 clusters in DAPC, here is the scatterplot I get with
 command "scatter(dapc_data, posi.da="bottomleft", bg="white", pch=17:22, scree.da=FALSE, col=myCol)" </div>
<div style="font-size:13.3333330154419px;background-color:rgb(255,255,255)">
<p></p>
<img src="cid:7fbe74d8-9d03-420b-a8dd-d913fb75500c" style="width:500px;min-height:460px">
<p></p>
<div style="font-size:13.3333330154419px">the assignment to the clusters didn't match my population structure perfectly so I need to indicate the origin (which one of 2 initial populations) of each individual in the clusters. </div>
<div style="font-size:13.3333330154419px"><br>
</div>
<div style="font-size:13.3333330154419px">I made 2 plots manually in Photoshop to represent my idea better:</div>
<div style="font-size:13.3333330154419px">
<p></p>
<p></p>
<img src="cid:859dc59a-2be3-4fa9-8b39-08413fa5b536" style="width:480px;min-height:360px">
<p></p>
<br>
<div dir="ltr" style="font-family:arial,sans-serif">
<br>
</div>
<br>
</div>
<div style="font-size:13.3333330154419px">or an easier to read color representation:</div>
<br>
<p></p>
<div dir="ltr" style="font-family:arial,sans-serif">
<div style="display:inline-block;font-size:11px;font-weight:bold;text-align:center;white-space:nowrap;margin-right:0px;min-height:24px;line-height:23px;min-width:0px;outline:0px;padding:0px;color:rgb(68,68,68);border:1px solid rgb(115,115,115);margin-left:8px;width:30px">
<div style="display:inline-block;vertical-align:middle;min-height:21px;width:21px">
</div>
</div>
<div style="display:inline-block;font-size:11px;font-weight:bold;text-align:center;white-space:nowrap;margin-right:0px;min-height:24px;line-height:23px;min-width:0px;outline:0px;padding:0px;color:rgb(68,68,68);border:1px solid rgb(115,115,115);margin-left:8px;width:30px">
<div style="display:inline-block;vertical-align:middle;min-height:21px;width:21px">
</div>
</div>
</div>
<br>
<p></p>
<img src="cid:fddf3b1d-c165-41a8-86b0-b374fab1d57f" style="width:480px;min-height:360px"><br>
<p></p>
</div>
<div style="font-size:13.3333330154419px;background-color:rgb(255,255,255)">
<div dir="ltr" style="font-family:arial,sans-serif">
<div title="Download" style="display:inline-block;font-size:11px;font-weight:bold;text-align:center;white-space:nowrap;margin-right:0px;min-height:24px;line-height:23px;min-width:0px;outline:0px;padding:0px;color:rgb(68,68,68);border:1px solid rgb(115,115,115);margin-left:8px;width:30px">
<div style="display:inline-block;vertical-align:middle;min-height:21px;width:21px">
</div>
</div>
<div title="Save to Drive" style="display:inline-block;font-size:11px;font-weight:bold;text-align:center;white-space:nowrap;margin-right:0px;min-height:24px;line-height:23px;min-width:0px;outline:0px;padding:0px;color:rgb(68,68,68);border:1px solid rgb(115,115,115);margin-left:8px;width:30px">
<div style="display:inline-block;vertical-align:middle;min-height:21px;width:21px">
<div style="display:inline-block;direction:ltr;min-height:19px;width:19px">
<div></div>
<div style="min-height:19px;width:19px">
</div>
</div>
</div>
</div>
</div>
<br>
</div>
<div style="font-size:13.3333330154419px;background-color:rgb(255,255,255)"><br>
</div>
<div style="font-size:13.3333330154419px;background-color:rgb(255,255,255)"><br>
</div>
<div style="font-size:13.3333330154419px;background-color:rgb(255,255,255)">Many thanks,</div>
<div style="font-size:13.3333330154419px;background-color:rgb(255,255,255)"><br>
</div>
<div style="font-size:13.3333330154419px;background-color:rgb(255,255,255)">Irina</div>
<div><br>
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">
<div>Irina Ilyushkina</div>
<div><br>
</div>
<div>PhD Candidate</div>
<div><font face="Arial,sans-serif"><span style="font-size:10pt">School</span></font><font face="Arial,sans-serif"><span style="font-size:10pt"> of </span></font><font face="Arial,sans-serif"><span style="font-size:10pt">Biological</span></font><font face="Arial,sans-serif"><span style="font-size:10pt"> Sciences</span></font></div>
<div>
<div style="font-family:Tahoma,Arial,Helvetica;font-size:medium;margin:0px"><font size="3" face="Times New Roman,serif"><span style="font-size:12pt"><font face="Arial,sans-serif"><span style="font-size:10pt">Victoria</span></font><font face="Arial,sans-serif"><span style="font-size:10pt"> </span></font><font face="Arial,sans-serif"><span style="font-size:10pt">University</span></font><font face="Arial,sans-serif"><span style="font-size:10pt"> of </span></font><font face="Arial,sans-serif"><span style="font-size:10pt">Wellington</span></font></span></font></div>
<div style="font-family:Tahoma,Arial,Helvetica;font-size:medium;margin:0px"><font size="3" face="Times New Roman,serif"><span style="font-size:12pt"><font face="Arial,sans-serif"><span style="font-size:10pt">P O Box</span></font><font face="Arial,sans-serif"><span style="font-size:10pt"> 600</span></font></span></font></div>
<div style="font-family:Tahoma,Arial,Helvetica;font-size:medium;margin:0px"><font size="3" face="Times New Roman,serif"><span style="font-size:12pt"><font face="Arial,sans-serif"><span style="font-size:10pt">Wellington 6140</span></font></span></font></div>
<div style="font-family:Tahoma,Arial,Helvetica;font-size:medium;margin:0px"><font size="3" face="Times New Roman,serif"><span style="font-size:12pt"><font face="Arial,sans-serif"><span style="font-size:10pt">New Zealand</span></font></span></font></div>
<div style="font-family:Tahoma,Arial,Helvetica;font-size:medium;margin:0px"><font size="3" face="Times New Roman,serif"><span style="font-size:12pt"><font face="Arial,sans-serif"><span style="font-size:10pt"> </span></font></span></font></div>
<div style="font-family:Tahoma,Arial,Helvetica;font-size:medium;margin:0px"><font size="3" face="Times New Roman,serif"><span style="font-size:12pt"><font face="Arial,sans-serif"><span style="font-size:10pt">Mobile: 0223898085</span></font></span></font></div>
<div style="font-family:Tahoma,Arial,Helvetica;font-size:medium;margin:0px"><font size="3" face="Times New Roman,serif"><span style="font-size:12pt"><font face="Arial,sans-serif"><span style="font-size:10pt">Tel: 04 463 5233 Ext 8135</span></font></span></font></div>
</div>
</div>
</div>
</div>
<div style="font-family:Times New Roman;color:#000000;font-size:16px">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma"><b>From:</b> Jombart, Thibaut [<a href="mailto:t.jombart@imperial.ac.uk" target="_blank">t.jombart@imperial.ac.uk</a>]<br>
<b>Sent:</b> Tuesday, 24 February 2015 12:58 a.m.<br>
<b>To:</b> Irina Ilyushkina; <a href="mailto:adegenet-forum@lists.r-forge.r-project.org" target="_blank">adegenet-forum@lists.r-forge.r-project.org</a><br>
<b>Subject:</b> RE: scatter plot problem<br>
</font><br>
</div><div><div class="h5">
<div></div>
<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt"><br>
<div><font>Hi Irina, <br>
<br>
I am not sure I understand what you are after, so sorry if I miss the point. If you want to represent a different group to the one used in the DAPC analysis on the DAPC scatterplot, use the argument 'grp'; from ?scatter.dapc:<br>
<br>
  grp: a factor defining group membership for the individuals. The<br>
          scatterplot is optimal only for the default group, i.e. the<br>
          one used in the DAPC analysis.<br>
<br>
Cheers<br>
Thibaut<br>
<br>
<br>
</font></div>
<div style="font-family:Times New Roman;color:#000000;font-size:16px">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma"><b>From:</b> <a href="mailto:adegenet-forum-bounces@lists.r-forge.r-project.org" target="_blank">adegenet-forum-bounces@lists.r-forge.r-project.org</a> [<a href="mailto:adegenet-forum-bounces@lists.r-forge.r-project.org" target="_blank">adegenet-forum-bounces@lists.r-forge.r-project.org</a>] on behalf of Irina Ilyushkina [<a href="mailto:Irina.Ilyushkina@vuw.ac.nz" target="_blank">Irina.Ilyushkina@vuw.ac.nz</a>]<br>
<b>Sent:</b> 23 February 2015 04:41<br>
<b>To:</b> <a href="mailto:adegenet-forum@lists.r-forge.r-project.org" target="_blank">adegenet-forum@lists.r-forge.r-project.org</a><br>
<b>Subject:</b> [adegenet-forum] scatter plot problem<br>
</font><br>
</div>
<div></div>
<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
<div>
</div>
Hi,
<div><br>
</div>
<div>I'm new to R and would be extremely grateful if someone could help me with my problem. I need to indicate (with labels, with color, etc.) the original group assignment of every individual in the DAPC inferred clusters on the scatter plot. table.value(table(pop(x),
 grp$grp) is showing the type of plot I'm after but it's a bit confusing when you have to consider two plots at the same time so I'm looking for a way to combine both in one plot if it is possible.</div>
<div><br>
</div>
<div>Many thanks,<br>
<div><br>
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">
<div>Irina</div>
<div></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div></div>
</div>
</div>
</div>
</div>
</div>
</div>

<br>_______________________________________________<br>
adegenet-forum mailing list<br>
<a href="mailto:adegenet-forum@lists.r-forge.r-project.org">adegenet-forum@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum</a><br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><span style="color:rgb(255,102,0)">Maria del Carmen David Salas</span><br></div>
</div>