gg_ordisurf: Ordisurf with ggplot2

View source: R/gg_ordisurf.R

gg_ordisurfR Documentation

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
)

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.

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.

Value

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

Note

Code for extracting plot data from the ordisurf result was taken from a blog by Oliviea Rata Burge.

Author(s)

Olivia Rata Burge, John Quensen

References

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

Examples

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")

jfq3/ggordiplots documentation built on Feb. 3, 2024, 11:50 p.m.