| gl.map.snmf | R Documentation |
This function takes the output of gl.plot.snmf (the Q matrix) and maps the
Q-matrix across using the population centers from the genlight object that
was used to run the snmf analysis via (gl.run.snmf)
and plots the typical snmf bar plots on a spatial map, providing a
barplot for each subpopulation. Therefore it requires coordinates from a
genlight object. This kind of plots should support the interpretation of the
spatial snmf of a population, but in principle is not different from
(gl.plot.snmf)
gl.map.snmf(
x,
qmat,
color_clusters = NULL,
provider = "Esri.NatGeoWorldMap",
scalex = 1,
scaley = 1,
movepops = NULL,
pop.labels = TRUE,
pop.labels.cex = 12
)
x |
Name of the genlight object containing the coordinates in the
|
qmat |
Q-matrix from a gl.plot.snmf [required]
[from |
color_clusters |
A color palette for clusters (K) or a list with |
provider |
Provider passed to leaflet. Check providers for a list of possible backgrounds [default "Esri.NatGeoWorldMap"]. |
scalex |
Scaling factor to determine the size of the bars in x direction [default 1] |
scaley |
Scaling factor to determine the size of the bars in y direction [default 1] |
movepops |
A two-dimensional data frame that allows to move the center of the barplots manually in case they overlap. Often if populations are horizontally close to each other. This needs to be a data.frame of the dimensions [rows=number of populations, columns = 2 (lon/lat)]. For each population you have to specify the x and y (lon and lat) units you want to move the center of the plot, (see example for details) [default NULL] |
pop.labels |
Switch for population labels below the parplots [default TRUE] |
pop.labels.cex |
Size of population labels [default 12] |
Creates a mapped version of snmf plots. For possible background maps check as specified via the provider: http://leaflet-extras.github.io/leaflet-providers/preview/index.html. You may need to adjust scalex and scaley values [default 1], as the size depends on the scale of the map and the position of the populations.
An interactive map that shows the PopCluster plots broken down by population.
returns the map and a list of the qmat split into sorted matrices per population. This can be used to create your own map.
Ching Ching Lau (Post to https://groups.google.com/d/forum/dartr)
Frichot E, Mathieu F, Trouillon T, Bouchard G, Francois O. (2014). Fast and Efficient Estimation of Individual Ancestry Coefficients. Genetics, 194(4): 973–983.
gl.run.snmf,
gl.plot.snmf
# examples need snmf to be installed on the system
## Not run:
m <- gl.run.snmf(x=bandicoot.gl, minK=1,
maxK=5, rep=10)
Q <- gl.plot.snmf(snmf_result=m, plot.K = 3, ind_name=T)
gl.map.snmf(bandicoot.gl, qmat=Q)
# move population 4 (out of 5) 0.5 degrees to the right and populations 1
# 0.3 degree to the north of the map.
mp <- data.frame(lon=c(0,0,0,0.5,0), lat=c(-0.3,0,0,0,0))
gl.map.snmf(bandicoot.gl, qmat=Q, movepops=mp)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.