plot.tess3Q: Display geographic maps of ancestry coefficients

View source: R/plotQ.R

plot.tess3QR Documentation

Display geographic maps of ancestry coefficients

Description

This function displays interpolated values of ancestry coefficients on geographic maps.

Usage

## S3 method for class 'tess3Q'
plot(x, coord, method = "map.max", resolution = c(300,
  300), window = NULL, background = TRUE, map.polygon = NULL,
  raster.filename = NULL, interpolation.model = FieldsKrigModel(10),
  col.palette = CreatePalette(), add.map = TRUE, ...)

Arguments

x

an object of class tess3Q containing an ancestry coefficient matrix computed from tess3.

coord

a numeric matrix of dimension n times 2 where n is the number of individuals. The matrix must contain (Longitude, Latitude) coordinates for all individuals.

method

a character string "map.max" or "map.all". If "map.all", interpolating surfaces are displayed for the ancestry coefficients of all populations. If "map.max" the union of interpolating surfaces is displayed.

resolution

an integer vector resolution = c(rx,ry) for the resolution of the grid used to computed the interpolating surface. rx and ry are resolution numbers for the x-axis and y-axis respectively.

window

an integer vector for the plotting window, such that window = c(xmin, xmax, ymin, ymax) contains the window's min and max coordinates.

background

if TRUE a raster file is used as a stencil to render only raster pixel on earth.

map.polygon

an object of class sp::SpatialPolygonsDataFrame used to crop the interpolating surface. If NULL, the function getMap is used.

raster.filename

a raster file name used to compute the background stencil. This is an alternative method to crop the interpolating surfaces. The default method uses map.polygon.

interpolation.model

an interpolation model used to compute the interpolating surface. Interpolation models can use the functions FieldsTpsModel or FieldsKrigModel.

col.palette

a list of color palettes. Color palettes can be defined by using the function CreatePalette.

...

plot.default other parameters.

Value

None

Author(s)

Kevin Caye, Flora Jay, Olivier François

Examples

library(tess3r)

# Retrieve a dataset
data(data.at)

# Run of TESS3
obj <- tess3(data.at$X, coord = data.at$coord, K = 5,
                 ploidy = 1, method = "projected.ls", openMP.core.num = 4)

# Get the ancestry matrix
Q.matrix <- qmatrix(obj, K = 5)

# Plot the spatial interpolation of the ancestry matrix
plot(Q.matrix, data.at$coord, method = "map.max",
     resolution = c(400,400),
     interpolation.model = FieldsKrigModel(10), cex = .4,
     xlab = "Longitude", ylab= "Latitude", main = "Ancestry coefficients")

bcm-uga/TESS3_encho_sen documentation built on June 30, 2023, 3:08 a.m.