plot.lddf: Plot the output of 'mldest()' or 'sldest()' using...

View source: R/generics.R

plot.lddfR Documentation

Plot the output of mldest() or sldest() using corrplot()

Description

Formats the LD estimates in the form of a matrix and creates a heatmap of these estimates. This heatmap is created using the corrplot R package. I've adjusted a lot of the defaults to suit my visualization preferences.

Usage

## S3 method for class 'lddf'
plot(
  x,
  element = "r2",
  type = c("upper", "full", "lower"),
  method = c("color", "circle", "square", "ellipse", "number", "shade", "pie"),
  diag = FALSE,
  is.corr = NULL,
  tl.pos = "n",
  title = NULL,
  na.label = "square",
  ...
)

Arguments

x

An object of class lddf, usually created using either mldest() or sldest().

element

Which element of x should we plot?

type

Character, "full", "upper" (default) or "lower", display full matrix, lower triangular or upper triangular matrix.

method

See corrplot() for available options. Default value is "color".

diag

Logical, whether display the correlation coefficients on the principal diagonal.

is.corr

See corrplot(). Default behavior is TRUE if an element is constrained between -1 and 1 and FALSE otherwise.

tl.pos

See corrplot(). Default value is "n".

title

What should the title be? Defaults to the element name.

na.label

See corrplot(). Default value is "square".

...

Additional arguments to pass to corrplot(). See the documentation of that function for options.

Details

For greater plotting flexibility, see corrplot() for the parameter options.

Value

(Invisibly) returns a matrix of the selected elements.

Author(s)

David Gerard

Examples

set.seed(1)

## Simulate genotypes when true correlation is 0
nloci <- 5
nind  <- 100
K <- 6
nc <- 1
genomat <- matrix(sample(0:K, nind * nloci, TRUE), nrow = nloci)

## Haplotypic LD estimates
lddf <- mldest(geno = genomat,
               K = K,
               nc = nc,
               type = "hap")

## Plot estimates of z
plot(lddf, element = "z")


ldsep documentation built on Oct. 19, 2022, 1:08 a.m.