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 |
memgene |
A matrix giving as columns the MEMGENE variables to be plotted (e.g. can be subsetted from the |
wid |
The width of the plotting device to be created. If |
hei |
The width of the plotting device to be created. If |
dev.open |
If |
add.plot |
If |
legend |
If |
... |
Additional parameters passed to the |
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)