Learn R Programming

vegan3d (version 1.3-0)

orditree3d: Draw Cluster Tree over a Plane

Description

Function draws a 3D plot where ordination result is at the bottom plane and a hclust dendrogram is drawn above the plane.

Usage

orditree3d(ord, cluster, prune = 0, display = "sites", choices = c(1, 2),
    col = "blue", text, type = "p", ...)
ordirgltree(ord, cluster, prune = 0, display = "sites", choices = c(1, 2),
    col = "blue", text, type = "p", ...)

Value

Function orditree3d returns invisibly a

scatterplot3d result object amended with items points and internal that give the projected coordinates of ordination scores and internal nodes, and

col.points and col.internal that give their colours. All matrix-like objects can be accessed with

scores.

Function ordirgltree returns nothing.

Arguments

ord

An ordination object or an ordiplot object or any other structure defining a 2D plane.

cluster

Result of hierarchic cluster analysis, such as hclust or agnes or any other clutering that can be coerced to a compliant format by as.hclust.

prune

Number of upper levels hierarchies removed from the tree. If prune > 0, tree will be cut into prune + 1 disconnected trees.

choices

Choice of ordination axes.

display

Ordination scores displayed.

col

Colour of tree. The colour can be a vector and it is used for the points, text and terminal branches. The colour of internal branches is a mixture of connected leaves.

text

Text to replace the default of item labels when type = "t".

type

Display of leaves: "p" for points, "t" for text, and "n" for no display.

...

Arguments passed to scores and graphical functions.

Author

Jari Oksanen.

Details

orditree3d uses scatterplot3d package to draw a static 3D plot of the dendrogram over the ordination, and ordirgltree uses rgl to make a dynamic, spinnable plot. The functions were developed to plot a cluster dendrogram over a 2D ordination plane, but any other plane can be used, for instance, a map.

See Also

orglcluster and ordicluster (in vegan).

Examples

Run this code
  data(dune, dune.env)
  d <- vegdist(dune)
  m <- metaMDS(d)
  cl <- hclust(d, "aver")
  orditree3d(m, cl, pch=16, col=cutree(cl, 3))
  ## ordirgltree makes ordinary rgl graphics. It accepts
  ## material3d() settings, and you can add elements to the
  ## open graph (for instance, bbox3d()).
  if (interactive() && require(rgl, quietly = TRUE)) {
  with(dune.env, ordirgltree(m, cl, col = as.numeric(Management), size = 6,
     lwd = 2, alpha = 0.6))
  }

Run the code above in your browser using DataLab