ord_plot: Alternative ordination plot for CCA and RDA objects (base...

View source: R/ord_plot.R

ord_plotR Documentation

Alternative ordination plot for CCA and RDA objects (base graphics)

Description

Alternative to plot vegan's CCA and RDA objects producing illustrative and good looking graphics with less code and need for customization. Plots envfit and ordisurf when needed.

Usage

ord_plot(
  mod,
  env_data = NULL,
  scaling = "species",
  size_preset = "device",
  ordisurf_var = NULL,
  centroids = TRUE,
  envfits = NULL,
  orditorp = TRUE,
  orditorp_air = 1,
  st_col = "grey70",
  st_symbol = "+",
  ordihull_st = FALSE,
  species = TRUE,
  sp_col = "black",
  sp_arrow = FALSE,
  sp_symbol = 20,
  sp_symbol_col = "black",
  sp_font = 3,
  latin_sp_names = FALSE,
  cn_col = "darkolivegreen",
  ordi_col = c("lightskyblue1", "lightsalmon1"),
  envfits_col = c("#649971", "#A47399", "#03617E", "#B5794C", "#FF9252", "#FF5F68",
    "#449BCF"),
  main_cex = NULL,
  st_cex = NULL,
  sp_cex = NULL,
  sp_symbol_cex = NULL,
  cn_cex = NULL,
  ordi_cex = NULL,
  envfits_cex = NULL,
  main = NULL,
  axis_labs = TRUE,
  legend_pos = "topleft",
  title.main = NULL,
  title.sub = NULL,
  ...
)

Arguments

mod

cca or rda object from vegan.

env_data

optional data frame containing environmental data, which should be fitted using the envfit and/or ordisurf functions. The data frame must have the same row order and number than the species data frame used to construct mod.

scaling

Scaling for species and site scores. See the scaling argument in plot.cca).

size_preset

character specifying the size preset for the graphic device. Options: "device" or "pdf". Size of symbols in the plot will be automatically scaled to the device or 122 mm wide pdf (page width for many scientific journals), respectively. You can override the scaling using the *_cex arguments.

ordisurf_var

character specifying the column name in env_data that should be used to plot ordisurf. If NULL, no ordisurf will be plotted.

centroids

logical indicating whether CCA or RDA centroids should be plotted (display = "cn" in plot.cca).

envfits

character vector specifying column names in env_data, which should be ploted with the envfit function.

orditorp

logical indicating whether orditorp should be used to avoid cluttered species names.

orditorp_air

numeric defining the air argument for orditorp.

st_col

character specifying the color for sites (display = "sites" in plot.cca). Alternatively column name in env_data and site color will be scaled to levels in the variable. Colors will be taken from the envfits_col argument.

st_symbol, sp_symbol

pch code for site and species symbols, respectively.

ordihull_st

logical indicating whether ordihull should be drawn around sites if site colors are scaled to env_data (see st_col).

species

logical indicating whether to show the species labels.

sp_col

character specifying the color for species (display = "species" in plot.cca).

sp_arrow

logical indicating whether biplot arrows should be plotted for species.

sp_symbol_col

character specifying the color for species symbols.

sp_font

An integer which specifies which font to use for text. If possible, device drivers arrange so that 1 corresponds to plain text (the default), 2 to bold face, 3 to italic and 4 to bold italic. Also, font 5 is expected to be the symbol font, in Adobe symbol encoding. On some devices font families can be selected by family to choose different sets of 5 fonts. From par.

latin_sp_names

logical indicating whether species abbreviations should be converted to latin names. This functionality is probably not working. Check.

cn_col

character specifying the color for centroids (display = "cn" in plot.cca).

ordi_col

character specifying the color for ordisurf.

envfits_col

character vector specifying the colors for envfit objects. If st_col is mapped to a variable, the envfits_col vector is reversed for environmental variables (envfits) to avoid overlapping colors.

main_cex

cex parameter for axes titles (par(cex)).

st_cex

cex parameter for site symbols.

sp_cex, sp_symbol_cex

cex parameter for species names and symbols, respectively.

cn_cex

cex parameter for centroids.

ordi_cex

cex parameter for ordisurf.

envfits_cex

cex parameter for envfit objects.

main

character specifying title for the plot. Overlaps with title.main. Fix.

axis_labs

logical indicating whether to plot axis labels.

legend_pos

character specifying the location of legend (only added if colors are mapped to variables). Set to NULL to remove the legend.

title.main

Overlaps with main. Fix.

title.sub

character specifying sub-title for the plot.

...

parameters passed to plot.cca

Details

While the function produces OK looking plots at the moment (and they seem to be correct too), the function needs to be rewritten to comply with vegan's "dialect". Also some features are redundant. I will do this rewriting at some point in the future when I have time. Also add examples.

Author(s)

Mikko Vihtakari with code from Jari Oksanen and Gavin Simpson


MikkoVihtakari/veganUtils documentation built on May 3, 2023, 9:58 a.m.