Learn R Programming

pophelper (version 1.2.0)

plotMultiline: Plot STRUCTURE, TESS, MATRIX run files and TAB files in multiline

Description

Plot STRUCTURE, TESS, MATRIX run files and TAB files as barplots with multiple lines

Usage

plotMultiline(files = NULL, spl = NA, lpp = NA, popcol = NA,
  indlab = NA, indlabfromfile = FALSE, sortind = NA, sortlabels = FALSE,
  na.rm = FALSE, barwidth = 0.9, barspace = NA, ticks = FALSE,
  yaxislabs = FALSE, indlabs = TRUE, labsize = 5, labangle = 90,
  labvjust = 0.5, labhjust = 1, imgtype = "png", height = NA,
  width = NA, res = NA, units = NA)

Arguments

files

A character vector of filenames or paths. One or more STRUCTURE, TESS, MATRIX, combined, aligned or merged files. Use choose.files(multi = TRUE) for interactive selection.

spl

An integer indicating samples per line. Defaults to 60.

lpp

An integer indicating lines per page. Defaults to 11.

popcol

A character vector of colours for clusters.

indlab

A character vector of individual labels equal to length of individuals.

indlabfromfile

A logical indicating if individual labels must be read from input file and used as labels.

sortind

A character indicating how individuals are sorted. Default is NA. Other options are 'all' or any one cluster (eg. 'Cluster1').

sortlabels

Deprecated. Not is use.

na.rm

Default set to FALSE. NAs are not removed from data, therefore ggplot prints warning messages for NAs. If set to TRUE, NAs are removed before plotting and ggplot NA warning is suppressed.

barwidth

A numeric indicating the width of the bars.

barspace

This argument is deprecated. A numeric indicating the space between the bars.

ticks

A logical indicating if ticks on axis should be displayed or not.

yaxislabs

A logical indicating if y-axis labels should be displayed or not.

indlabs

A logical indicating if individual labels 1, 2, 3.. are displayed below bars. To hide labels, set indlabs = FALSE.

labsize

A numeric denoting size of the labels.

labangle

A numeric denoting the angle of the labels.

labvjust

A numeric denoting vertical justification of the labels.

labhjust

A numeric denoting the horizontal justification of the labels.

imgtype

A character denoting figure output format. Options are 'png', 'jpeg' or 'pdf'. If pdf, height and width must be in inches and res argument is ignored.

height

A numeric denoting height of the full figure. If NA, height is set to 29.7cm (A4 height).

width

A numeric denoting width of the full figure. If NA, width is set to 21cm (A4 width).

res

A numeric denoting resolution of the figure. Default is 300.

units

A character denoting the units of dimension of the figure. Default is "cm". Other options can be "in", "mm" or "px".

Details

Figures are always created to A4 size. Any plotted row will span the width of the figure. Note that this function is slow and may take several minutes when plotting mutiple tables.

Examples

Run this code
# NOT RUN {
slist <- list.files(path=system.file("files/structure",package="pophelper"),full.names=TRUE)

#basic
plotMultiline(sfiles[1])

#adjust spl and lpp
plotMultiline(slist[1],spl=75,lpp=10)

#sort individuals
plotMultiline(slist[1],sortind="all")
plotMultiline(slist[1],sortind="Cluster1")

#include labels from file
plotMultiline(slist[1],indlabfromfile=T)

#external ind labels
inds <- read.delim(system.file("files/structureindlabels.txt",package="pophelper"),header=FALSE)
plotMultiline(slist[1],indlab=inds$V1)
# }

Run the code above in your browser using DataLab