mgMap | R Documentation |
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.
mgMap(coords, memgene, wid = NULL, hei = NULL, dev.open = FALSE, add.plot = FALSE, legend = FALSE, ...)
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 |
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.
Side effect. A plot is produced.
Pedro Peres-Neto (peres-neto.pedro@uqam.ca)
Paul Galpern (pgalpern@ucalgary.ca)
Borcard, D., Gillet, F., and Legendre. P. 2011. Numerical Ecology with R. Springer, New York.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.