Learn R Programming

dartR.base (version 1.0.5)

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

Description

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

Usage

gl.map.interactive(
  x,
  matrix = NULL,
  standard = TRUE,
  symmetric = TRUE,
  pop.labels = TRUE,
  pop.labels.cex = 12,
  ind.circles = TRUE,
  ind.circle.cols = rainbow,
  ind.circle.cex = 10,
  ind.circle.transparency = 0.8,
  palette.links = NULL,
  legend.title = NULL,
  provider = "Esri.NatGeoWorldMap",
  raster.image = NULL,
  raster.opacity = 0.5,
  raster.colors = (scales::viridis_pal(option = "D"))(255),
  verbose = NULL
)

Value

plots a map

Arguments

x

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

matrix

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

standard

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

symmetric

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

pop.labels

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

pop.labels.cex

Size of population labels [default 12].

ind.circles

Should individuals plotted as circles [default TRUE].

ind.circle.cols

Colors of circles. A color palette or a vectot with as many colors as there are populations in the dataset [default rainbow].

ind.circle.cex

Size or circles in pixels [default 10].

ind.circle.transparency

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

palette.links

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

legend.title

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

provider

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

raster.image

Path to a georeferenced raster image to plot [default NULL].

raster.opacity

The opacity of the raster, expressed from 0 to 1 [default 0.5].

raster.colors

The color palette to use to color the raster values [default scales::viridis_pal(option = "D")(255)].

verbose

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

Author

Bernd Gruber -- Post to https://groups.google.com/d/forum/dartr

Details

A wrapper around the leaflet package. For possible background maps check as specified via the provider: http://leaflet-extras.github.io/leaflet-providers/preview/index.html

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").

See Also

Other graphics: gl.colors(), gl.plot.heatmap(), gl.report.ld.map(), gl.select.colors(), gl.select.shapes(), gl.smearplot(), gl.tree.nj()

Examples

Run this code
require("dartR.data")
gl.map.interactive(bandicoot.gl)
cols <- c("red","blue","yellow")
gl.map.interactive(platypus.gl, ind.circle.cols=cols, ind.circle.cex=10, 
ind.circle.transparency=0.5)

Run the code above in your browser using DataLab