gg_ordisurf | R Documentation |
Fits a surface (contour) plot of an environmental variable to an ordination plot.
gg_ordisurf(
ord,
env.var,
groups = NA,
choices = c(1, 2),
var.label = "Level",
binwidth,
pt.size = 3,
family = "gaussian",
plot = TRUE
)
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. |
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.
Silently returns the plot and data frames used for the plotting.
Code for extracting plot data from the ordisurf result was taken from a blog by Oliviea Rata Burge.
Olivia Rata Burge, John Quensen
https://oliviarata.wordpress.com/2014/07/17/ordinations-in-ggplot2-v2-ordisurf/'
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.