membershipPlot: Plot a series of stacked bars indicating membership

Description Usage Arguments Details Value References Examples

View source: R/membershipPlot.R

Description

Plot a series of stacked bars indicating membership of species across sites, items across groups, or however the contents of tab should be interpreted. In the descriptions below we will treat tab as describing species counts across sites.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Default S3 method:
membershipPlot(tab, ...)

## S3 method for class 'divtable'
membershipPlot(tab, fill.method = c("colour", "bw",
  "color"), fill.palette = "Dark2", distinguish.multiton = TRUE,
  xlab = "Site", ylab = "Membership", las = 1, x.mar.width = ifelse(las
  >= 2, 4, 3), cex = 0.7, cex.names = 0.85, l1 = NULL, l2 = NULL,
  annotate.cex = 0.9, annotate = function() {     xl <- seq(0.8, by = 1.3,
  length.out = max(length(l1), length(l2)))     if (!is.null(l1))         
  mtext(l1, at = xl, line = 0.8, cex = annotate.cex, xpd = NA)     if
  (!is.null(l2))          mtext(l2, at = xl, line = 0.4, cex = annotate.cex, xpd
  = NA) }, file = NULL, file.dim = c(5.25, 2), ...)

Arguments

tab

Object of class divtable containing counts of sites (rows) by species membership (columns), or any similar object (table, matrix, data.frame, xtabs) that can be converted with as.divtable. This argument is normalized to sum to 1 within each site so values may be counts or proportions.

fill.method

"colour" (the default, with synonym "color"), or "bw", for the method of colouring different species within the plots. For "colour", no more than eight separate colours are chosen; if there are more than eight species, the colours for lower-frequency groups are modified by hatching lines of varying angles and densities. For "bw", fewer grades of grey are used, together with black-and-white patterns and hatching. For "colour", if the package RColorBrewer is available, colours will be chosen from the pallete designated by the fill.pallete option. The aesthetics of colour choice are important for distinguishing among species in membership plots. If RColorBrewer is not available, colours are chosen using rainbow.

fill.palette

For fill.method = "colour", if the package RColorBrewer is available, use this palette to choose the base colours to use. Default is "Dark2".

distinguish.multiton

For fill.method = "colour", whether to distinguish multiton groups (see Description) with grey rather than the default white colour. Default is TRUE.

xlab, ylab, las, cex

Plot parameters (see par

x.mar.width

Width of the X-margin

cex.names

Character expansion factor for the names plotted below the bars

l1, l2, annotate.cex, annotate

First and second lines of annotation to appear above bars in a bar plot, the character expansion factor to use, and the function to place them there. Alternate annotations may be enabled by redefining annotate.

file

If specified, produce PDF output to file, using pdf. Options onefile = FALSE, paper = "special" are used.

file.dim

If file is specified, dimensions of the PDF plot in inches

Details

In the plot, species are ordered bottom to top in order of decreasing total abundance. Species which are present in more than one site are given a unique colour/hatching combination, with hatching used only if the number of species is greater than the number of readily distinguishable colours, currently set to 8. Multiton species, with more than one individual but all individual appearing within a single site, are coloured grey when fill.method = "colour", and are coloured white when fill.method = "bw" or distinguish.multiton = FALSE. Singleton groups, those with just one member, are coloured white within their respective sites.

Examples of membership plots in publications can be found in Scofield et al. (2010), Scofield et al. (2011) and Scofield et al. (2012).

Value

No value is returned

References

Scofield, D. G., Sork, V. L. and Smouse, P. E. (2010) Influence of acorn woodpecker social behaviour on transport of coast live oak (Quercus agrifolia) acorns in a southern California oak savanna. Journal of Ecology 98:561-572.

Scofield, D. G., Alfaro, V. R., Sork, V. L., Grivet, D., Martinez, E., Papp, J., Pluess, A. R., Koenig, W. D. and Smouse, P. E. (2011) Foraging patterns of acorn woodpeckers (Melanerpes formicivorus) on valley oak (Quercus lobata N\'ee) in two California oak savanna-woodlands. Oecologia 166:187-196.

Scofield, D. G., Smouse, P. E., Karubian, J. and Sork, V. L. (2012) Use of alpha, beta and gamma diversity measures to characterize seed dispersal by animals. American Naturalist 180:719-732.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## create table of random membership data
n.sites <- 5
n.sources <- 10
n.samples <- 160
## data frame of site-source pairs
set.seed(75333)
t <- data.frame(site = sample(n.sites, n.samples, replace = TRUE),
                source = round(runif(n.samples) * n.sources + 0.5))
## create site-by-source table
tab <- as.divtable(table(t))
membershipPlot(tab)

douglasgscofield/dispersalDiversity documentation built on March 30, 2021, 9:50 a.m.