<div dir="ltr"><div>This must be somewhere in the email records, it's a message from Caitlin Collins on 2014:<br><br>Hi, <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><div><br>The
comments in the example above hopefully should give you all of the
relevant information, so please give them a read and then feel free to
let me know if you have any questions. You will almost certainly want to
play around with the arguments clabel and boxes in the s.label function
to get the labels to be readable for your case. </div>I hope that helps! <br>--------------------------------------<br></div>I don't know if it will have the same results now, I mean, in case any upgrade in the package could have change the function of these commands. But it worked fine when I used it back then.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 28, 2017 at 4:43 PM, Mahon, Andrew R <span dir="ltr"><<a href="mailto:mahon2a@cmich.edu" target="_blank">mahon2a@cmich.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
Hi all,
<div>New to using adegenet. Quick question (that may or may not be simple….). Is there a way to use actual sample labels (i.e., what I named them) and plotting them in the scatter of the DAPC (i.e., when you run scatter(dapc) command)?</div>
<div><br>
</div>
<div>Thanks for any help in advance.</div>
<div><br>
</div>
<div>-andy</div><span class="HOEnZb"><font color="#888888">
<div>
<div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<div>-- <br>
<br>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</font></span></div>
<br>______________________________<wbr>_________________<br>
adegenet-forum mailing list<br>
<a href="mailto:adegenet-forum@lists.r-forge.r-project.org">adegenet-forum@lists.r-forge.<wbr>r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum" rel="noreferrer" target="_blank">https://lists.r-forge.r-<wbr>project.org/cgi-bin/mailman/<wbr>listinfo/adegenet-forum</a><br></blockquote></div><br></div>