Skip to contents

This function takes the output of plotstructure (the q matrix) and maps the q-matrix across using the population centers from the genlight object that was used to run the structure analysis via and plots the typical structure 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 structure of a population, but in principle is not different from gl.plot.structure

  provider = "Esri.NatGeoWorldMap",
  scalex = 1,
  scaley = 1,
  movepops = NULL,
  pop.labels = TRUE,
  pop.labels.cex = 12



Q-matrix from a structure run followed by a clumpp run object [from and gl.plot.structure] [required].


Name of the genlight object containing the coordinates in the \@other$latlon slot to calculate the population centers [required].


The number for K to be plotted [required].


Provider passed to leaflet. Check providers for a list of possible backgrounds [default "Esri.NatGeoWorldMap"].


Scaling factor to determine the size of the bars in x direction [default 1].


Scaling factor to determine the size of the bars in y direction [default 1].


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


Switch for population labels below the parplots [default TRUE].


Size of population labels [default 12].


An interactive map that shows the structure 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.


Creates a mapped version of structure plots. For possible background maps check as specified via the provider: 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.


  • Pritchard, J.K., Stephens, M., Donnelly, P. (2000) Inference of population structure using multilocus genotype data. Genetics 155, 945-959.

  • Archer, F. I., Adams, P. E. and Schneiders, B. B. (2016) strataG: An R package for manipulating, summarizing and analysing population genetic data. Mol Ecol Resour. doi:10.1111/1755-0998.12559

  • Evanno, G., Regnaut, S., and J. Goudet. 2005. Detecting the number of clusters of individuals using the software STRUCTURE: a simulation study. Molecular Ecology 14:2611-2620.

  • Mattias Jakobsson and Noah A. Rosenberg. 2007. CLUMPP: a cluster matching and permutation program for dealing with label switching and multimodality in analysis of population structure. Bioinformatics 23(14):1801-1806. Available at clumpp


Bernd Gruber (Post to


if (FALSE) {
#bc <-[,1:100]
#sr <-, k.range = 2:5, num.k.rep = 3, exec = './structure.exe')
#ev <- gl.evanno(sr)
#qmat <- gl.plot.structure(sr, k=2:4)#' #head(qmat), bc,K=3), bc,K=4)
#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)), bc,K=4, movepops=mp)