Skip to contents

Creates an interactive map (based on latlon) from a genlight object

  matrix = NULL,
  standard = TRUE,
  symmetric = TRUE,
  pop.labels = TRUE,
  pop.labels.cex = 12,
  ind.circles = TRUE, = NULL, = 10, = 0.8,
  palette_links = NULL,
  leg_title = NULL,
  provider = "Esri.NatGeoWorldMap",
  verbose = NULL



A genlight object (including coordinates within the latlon slot) [required].


A distance matrix between populations or individuals. The matrix is visualised as lines between individuals/populations. If matrix is asymmetric two lines with arrows are plotted [default NULL].


If a matrix is provided line width will be standardised to be between 1 to 10, if set to true, otherwise taken as given [default TRUE].


If a symmetric matrix is provided only one line is drawn based on the lower triangle of the matrix. If set to false arrows indicating the direction are used instead [default TRUE].


Population labels at the center of the individuals of populations [default TRUE].


Size of population labels [default 12].


Should individuals plotted as circles [default TRUE].

Colors of circles. Colors can be provided as usual by names (e.g. "black") and are re-cycled. So a color c("blue","red") colors individuals alternatively between blue and red using the genlight object order of individuals. For transparency see parameter Defaults to rainbow colors by population if not provided. If you want to have your own colors for each population, check the example below.

(size or circles in pixels ) [default 10].

Transparency of circles between 0=invisible and 1=no transparency. Defaults to 0.8.


Color palette for the links in case a matrix is provided [default NULL].


Legend's title for the links in case a matrix is provided [default NULL].


Passed to leaflet [default "Esri.NatGeoWorldMap"].


Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default 2, unless specified using gl.set.verbosity].


plots a map


A wrapper around the leaflet package. For possible background maps check as specified via the provider:

The palette_links argument can be any of the following: A character vector of RGB or named colors. Examples: palette(), c("#000000", "#0000FF", "#FFFFFF"), topo.colors(10)

The name of an RColorBrewer palette, e.g. "BuPu" or "Greens".

The full name of a viridis palette: "viridis", "magma", "inferno", or "plasma".

A function that receives a single value between 0 and 1 and returns a color. Examples: colorRamp(c("#000000", "#FFFFFF"), interpolate = "spline").


Bernd Gruber -- Post to


#> Starting 
#>   Processing genlight object with SNP data
#> Completed: 
cols <- c("red","blue","yellow")[as.numeric(pop(],,, #> Starting #> Processing genlight object with SNP data #> Warning: data include loci that are scored NA across all individuals. #> Consider filtering using gl <- gl.filter.allna(gl) #> Completed: #>