orditree3d: Draw Cluster Tree over a Plane

Description Usage Arguments Details Value Author(s) See Also Examples

Description

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

Usage

1
2
3
4
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", ...)

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.

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.

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.

Author(s)

Jari Oksanen.

See Also

orglcluster and ordicluster (in vegan).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  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
  ## rgl.material() 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))
  }

Example output

Loading required package: vegan
Loading required package: permute
Loading required package: lattice
This is vegan 2.5-3
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
Run 0 stress 0.1192678 
Run 1 stress 0.1183186 
... New best solution
... Procrustes: rmse 0.02027025  max resid 0.06495698 
Run 2 stress 0.1183186 
... Procrustes: rmse 1.68137e-05  max resid 5.417277e-05 
... Similar to previous best
Run 3 stress 0.1192679 
Run 4 stress 0.119268 
Run 5 stress 0.1192686 
Run 6 stress 0.119268 
Run 7 stress 0.1192678 
Run 8 stress 0.1192679 
Run 9 stress 0.1183186 
... New best solution
... Procrustes: rmse 9.014841e-06  max resid 2.822794e-05 
... Similar to previous best
Run 10 stress 0.1192679 
Run 11 stress 0.1192692 
Run 12 stress 0.1808915 
Run 13 stress 0.1183186 
... Procrustes: rmse 9.458469e-06  max resid 3.07752e-05 
... Similar to previous best
Run 14 stress 0.1192679 
Run 15 stress 0.1939208 
Run 16 stress 0.1183186 
... New best solution
... Procrustes: rmse 3.160666e-06  max resid 8.838868e-06 
... Similar to previous best
Run 17 stress 0.1192679 
Run 18 stress 0.1183186 
... Procrustes: rmse 2.741707e-05  max resid 8.838782e-05 
... Similar to previous best
Run 19 stress 0.2034383 
Run 20 stress 0.1183186 
... Procrustes: rmse 8.220709e-05  max resid 0.0002677182 
... Similar to previous best
*** Solution reached

vegan3d documentation built on May 2, 2019, 2:44 a.m.