Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ordiplot3d

Three-Dimensional Ordination Graphics


Description

Function ordiplot3d displays three-dimensional ordination graphics using scatterplot3d. Function works with all ordination results form vegan and all ordination results known by scores function.

Usage

ordiplot3d(object, display = "sites", choices = 1:3, col = "black",
    ax.col = "red", arr.len = 0.1, arr.col = "blue", envfit,
    xlab, ylab, zlab, ...)

Arguments

object

An ordination result or any object known by scores.

display

Display "sites" or "species" or other ordination object recognized by scores.

choices

Selected three axes.

col

Colours of points. Can be a vector, and factors are interpreted as their internal numerical codes.

ax.col

Axis colour (concerns only the crossed axes through the origin).

arr.len

'Length' (width) of arrow head passed to arrows function.

arr.col

Colour of biplot arrows and centroids of environmental variables.

envfit

Fitted environmental variables from envfit displayed in the graph.

xlab, ylab, zlab

Axis labels passed to scatterplot3d. If missing, labels are taken from the ordination result. Set to NA to suppress labels.

...

Other parameters passed to graphical functions.

Details

Function ordiplot3d plots static three-dimensional scatter diagrams using scatterplot3d. Function uses most default settings of underlying graphical functions, and you must consult their help pages to change graphics to suit your taste (see scatterplot3d).

Function returns invisibly an object of class ordiplot3d which inherits from ordiplot. The result object contains the projected coordinates of plotted items and functions to convert 3D data to 2D (see scatterplot3d). Function will display only one selected set of scores, typically either "sites" or "species". Examples show how to use the invisible return object to add another set of points to the projected plot.

In constrained ordination (cca, rda, capscale), biplot arrows and centroids are always displayed similarly as in two-dimensional plotting function plot.cca. Alternatively, it is possible to display fitted environmental vectors or class centroids from envfit. These are displayed similarly as the results of constrained ordination, and they can be shown only for non-constrained ordination. The user must remember to specify at least three axes in envfit if the results are used with these functions.

The function has a scores method to extract the projected coordinates from the invisible return object. Standard vegan functions can be used with the returned object. You can use any function from the ordihull and ordiarrows families (see Examples).

Value

Function ordiplot3d returns invisibly an object of class "ordiplot3d" inheriting from ordiplot. The return object will contain the coordinates projected onto two dimensions for points, and the projected coordinates of origin, and possibly the projected coordinates of the heads of arrows and centroids of environmental variables. The result will also contain the object returned by scatterplot3d, including function xyz.convert which projects three-dimensional coordinates onto the plane used in the current plot (see Examples). In addition, there is a function envfit.convert that projects a three-dimensional envfit object to the current plot.

Warning

Please note that scatterplot3d sets internally some graphical parameters (such as mar for margins) and does not honour default settings. It is advisable to study carefully the documentation and examples of scatterplot3d.

Author(s)

Jari Oksanen

See Also

Examples

### Default 'ordiplot3d'
data(dune, dune.env)
ord <- cca(dune ~ A1 + Moisture, dune.env)
ordiplot3d(ord)
### A boxed 'pin' version
ordiplot3d(ord, type = "h")
### More user control
pl <- ordiplot3d(ord, scaling = "symmetric", angle=15, type="n")
points(pl, "points", pch=16, col="red", cex = 0.7)
### identify(pl, "arrows", col="blue") would put labels in better positions
text(pl, "arrows", col="blue", pos=3)
text(pl, "centroids", col="blue", pos=1, cex = 1)
### Add species using xyz.convert function returned by ordiplot3d
sp <- scores(ord, choices=1:3, display="species", scaling="symmetric")
text(pl$xyz.convert(sp), rownames(sp), cex=0.7, xpd=TRUE)
### Two ways of adding fitted variables to ordination plots
ord <- cca(dune)
ef <- envfit(ord ~ Moisture + A1, dune.env, choices = 1:3)
### 1. use argument 'envfit'
ordiplot3d(ord, envfit = ef)
### 2. use returned envfit.convert function for better user control
pl3 <- ordiplot3d(ord)
plot(pl3$envfit.convert(ef), at = pl3$origin)
### envfit.convert() also handles different 'choices' of axes
pl3 <- ordiplot3d(ord, choices = c(1,3,2))
plot(pl3$envfit.convert(ef), at = pl3$origin)
### vegan::ordiXXXX functions can add items to the plot
ord <- cca(dune)
pl4 <- with(dune.env, ordiplot3d(ord, col = Management, pch=16))
with(dune.env, ordiellipse(pl4, Management, draw = "poly", col = 1:4,
  alpha = 60))
with(dune.env, ordispider(pl4, Management, col = 1:4, label = TRUE))

vegan3d

Static and Dynamic 3D Plots for the 'vegan' Package

v1.1-2
GPL-2
Authors
Jari Oksanen [aut, cre], Roeland Kindt [aut], Gavin L. Simpson [aut]
Initial release
2018-10-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.