dapc.plot.arrange: Arrange DAPC density plots. Function to arrange plots of...

View source: R/DAPC_adegenet.R

dapc.plot.arrangeR Documentation

Arrange DAPC density plots. Function to arrange plots of density for each DF or PC and each K

Description

Arrange DAPC density plots.

Function to arrange plots of density for each DF or PC and each K

Usage

## S3 method for class 'plot.arrange'
dapc(
  x,
  variable = "DF",
  layout.mat = NULL,
  pos.x.labs = 1,
  pos.y.labs = 2,
  row.labels.left = NULL,
  col.labels.top = NULL,
  row.labels.right = NULL,
  col.labels.bottom = NULL,
  use.diag = NULL,
  pad = 0.1,
  K = NULL,
  outer.text = list(NULL, NULL, NULL, NULL),
  maxMat = c(7, 2)
)

Arguments

x

A list of ggplots produced by ggscatter.dapc function

variable

Either "DF" or "PC"

layout.mat

Custom layout matrix to use. Default is NULL, in which case the layout will be generated automatically as a function of the number of plots.

pos.x.labs

Where the default labels x axis labels (i.e., column labels) should be drawn. Default = 1 (below table of plots); alternatively 3 (above plot).

pos.y.labs

Where the default labels y axis labels (i.e., row labels) should be drawn. Default = 2 (left side); alternatively 3 (right side).

row.labels.left

Labels to use the left of the first column of plots. Default NULL (no labels).

col.labels.top

Text labels to use above the first row of plots. Default NULL (no labels).

row.labels.right

Text labels to to the right of the last column of plots. Default NULL (no labels).

col.labels.bottom

Text labels to use below the bottom row of plots. Default NULL (no labels).

use.diag

NULL (the default) or numerical vector with values in 1:4, indicating which sides of the gtable (1=bottom, 2=left, 3=top, 4=right) should have labels applied to the diagonal rather than the table margin plots. Ignored if layout.mat is not square. For example, if use.diag=1, then the values of col.labels.bottom will appear below the plots on the diagonal rather than below the plots of the bottom row.

pad

Amount of space between plots, in units of line widths (Default 0.1).

K

Which set of biplots to use. If NULL (the default), the function will attemp to draw all biplots for all K (max 25 plots).

outer.text

A list with length=4, with each entry either NULL (the default) or character string to use as labels below, left, above, and to the right of the arrangement of plots.

maxMat

Numerical vector with length 2 that specifies the maximum number of rows and columns of plots, respectively, in the output gtable. Default = c(7,8).

Value

A gtable object

Examples

library(misc.wrappers)
# Define path to input VCF file containing similated data for 500 SNPs from 50 individuals in three populations.
example_vcf_path <- file.path(system.file("extdata", package = "misc.wrappers"),"simK4.vcf.gz")
# DAPC analyses for K=2–10 and 30 replicates of find.clusters (adegenet). Saves graphs to "DAPC_example.pdf" in your current directory.
run_DAPC(x=example_vcf_path, kmax=10, reps=30, save.as="DAPC_example.pdf", include.out=c(".pdf"))
Performs 30 replicates adegenet::find.clusters and plot boxplots of the K vs. BIC;  on the simulated dataset; 

JeffWeinell/misc.wrappers documentation built on Sept. 20, 2023, 12:42 p.m.