Learn R Programming

dartR (version 1.1.11)

gl.pcoa.plot.3d: 3D interactive plot of the results of a PCoA ordination

Description

This script takes output from the ordination undertaken using gl.pcoa() and plots the individuals in 3D space. The visualisation can be rotated with the mouse to examine the structure.

Usage

gl.pcoa.plot.3d(x, gl, title = "PCoA", xaxis = 1, yaxis = 2,
  zaxis = 3, shape = "sphere", radius = 2, legend = "topright")

Arguments

x

-- name of the glPca object containing the factor scores and eigenvalues [required]

gl

-- name of the genlight object from which the PCoA was generated

title

-- a title for the plot [default "PCoA"]

xaxis

-- identify the x axis from those available in the ordination (xaxis <= nfactors) [default 1]

yaxis

-- identify the y axis from those available in the ordination (yaxis <= nfactors) [default 2]

zaxis

-- identify the z axis from those available in the ordination (zaxis <= nfactors) [default 3]

shape

-- shape of the points, one of sphere, tetrahaedron or cube [default "sphere"]

radius

-- size of the points [default 2]

legend

-- one of bottomright, bottom, bottomleft, left, topleft, top, topright, right, center [default "bottom"]

Value

An interactive 3D plot of the ordination in a separate window

Details

The factor scores are taken from the output of gl.pcoa(), an object of class glPca, and the population assignments from the original data file and plots the specimens in a 3D plot.

Axes can be specified from the ordination, provided they are within the range of the nfactors value provided to gl.pcoa().

This script is essentially a wrapper for function pca3d {pca3d} maintained by January Weiner.

Examples

Run this code
# NOT RUN {
library(rgl)  #needed for the example
pcoa <- gl.pcoa(testset.gl, nfactor=5)
gl.pcoa.plot.3d(pcoa, testset.gl, xaxis=1, yaxis=2, zaxis=3)
# }

Run the code above in your browser using DataLab