Learn R Programming

ggordiplots (version 0.4.3)

gg_ordisurf: Ordisurf with ggplot2

Description

Fits a surface (contour) plot of an environmental variable to an ordination plot.

Usage

gg_ordisurf(
  ord,
  env.var,
  groups = NA,
  choices = c(1, 2),
  var.label = "Level",
  binwidth,
  pt.size = 3,
  family = "gaussian",
  plot = TRUE
)

Value

Silently returns the plot and data frames used for the plotting.

Arguments

ord

An ordination object.

env.var

Environmental variable to fit to plot.

groups

A vector of groups (optional).

choices

Axes to plot.

var.label

Label for the contour legend; default is "Level."

binwidth

Controls the number of contours in the plot.

pt.size

Symbol size.

family

Error distribution and link function used by the gam function to fit the contours.

plot

A logical for plotting; defaults to TRUE.

Author

Olivia Rata Burge, John Quensen

Details

By default, `binwidth` is calculated as the difference between minimum and maximum values of the variable divided by 15.

The colors for the points are mapped to fill; if you want to rename the legend for the groups (points), use labs(fill="New name").

See the help for stats::family for possible values for family.

References

https://oliviarata.wordpress.com/2014/07/17/ordinations-in-ggplot2-v2-ordisurf/'

Examples

Run this code
data(varespec)
data(varechem)
vare.dist <- vegdist(varespec)
vare.mds <- monoMDS(vare.dist)
gg_ordisurf(vare.mds, env.var = varechem$Baresoil, var.label="Bare Soil")

Run the code above in your browser using DataLab