mgMap {memgene}R Documentation

Visualization of MEMGENE variables

Description

A high-level plotting interface for the bubble plot visualization of MEMGENE variables.
If there are exactly two columns in memgene and therefore two MEMGENE variables to be plotted, then a single plotting window is created with the two plots side by side. Otherwise each MEMGENE variable is plotted in its own window unless.

Usage

mgMap(coords, memgene, wid = NULL, hei = NULL, dev.open = FALSE,
    add.plot = FALSE, legend = FALSE, ...)

Arguments

coords

A two column matrix or data.frame of x and y coordinates of sampling locations of individual genotypes

memgene

A matrix giving as columns the MEMGENE variables to be plotted (e.g. can be subsetted from the $memgene element produced by mgQuick)

wid

The width of the plotting device to be created. If NULL the decision is made by the function.

hei

The width of the plotting device to be created. If NULL the decision is made by the function.

dev.open

If TRUE do not open a new plotting device.

add.plot

If TRUE superimposing bubbles on an existing plot or map.

legend

If TRUE add a legend to the plot

...

Additional parameters passed to the sr.value function modified from Borcard et al (2011).

Details

This function embeds slightly modified versions of sr.value, scatterutil.legend.bw.circle, and scatterutil.legend.circle.grey distributed with Borcard et al. (2012) which are themselves modified from similar functions distributed with the ade4 package under a GPL-2 license.

Value

Side effect. A plot is produced.

Author(s)

Pedro Peres-Neto (peres-neto.pedro@uqam.ca)
Paul Galpern (pgalpern@ucalgary.ca)

References

Borcard, D., Gillet, F., and Legendre. P. 2011. Numerical Ecology with R. Springer, New York.

Examples

## Not run: 
## Prepare the radial data for analysis
radialData <- read.csv(system.file("extdata/radial.csv", package="memgene"))
radialGen <- radialData[, -c(1,2)]
radialXY <- radialData[, 1:2]
if (require(adegenet)) {
  radialDM <- codomToPropShared(radialGen)
} else {
  stop("adegenent package required to produce genetic distance matrix in example.")
}

## Run the MEMGENE analysis
radialAnalysis <- mgQuick(radialDM, radialXY)

## Visualize the first two MEMGENE variables side-by-side
mgMap(radialXY, radialAnalysis$memgene[, 1:2])

## Visualize the first MEMGENE variable superimposed over a raster map
## with the same coordinate system, AND include a legend
if (require(raster)) {
    resistanceMap <- raster(system.file("extdata/radial.asc", package="memgene"))
    plot(resistanceMap, legend=FALSE)
    mgMap(radialXY, radialAnalysis$memgene[, 1], add.plot=TRUE, legend=TRUE)
} else {
    mgMap(radialXY, radialAnalysis$memgene[, 1], legend=TRUE)
}


## End(Not run)

[Package memgene version 1.0.2 Index]