pez (version 1.2-0)

plot.comparative.comm: Dot-plots of community presence/absence or abundance

Description

Dot-plots of community presence/absence or abundance

Usage

# S3 method for comparative.comm
plot(x, sites = NULL, abundance = FALSE,
  pch = 20, dot.cex = NULL, site.col = "black", fraction = 3,
  x.increment = NULL, show.tip.label = FALSE, ...)

Arguments

sites

names of sites to plot (default: all); see examples

abundance

make size proportional to species abundance (default: FALSE)

pch

plotting character to be used for sites (see pch)

dot.cex

function to determine point size; see examples, this isn't as terrible-sounding as it seems.

site.col

colours to use when plotting sites; if not same length as number of sites, only the first element is used (no recycling)

fraction

fraction of plot window to be taken up with phylogeny; e.g., 3 (default) means phylogeny is 1/3 of plot

x.increment

specify exact spacing of points along plot; see examples

show.tip.label

whether to plot species names on phylogeney (default: FALSE)

...

additional arguments passed to plotting functions

Value

List containing plot.phylo information, as well as the used x.adj values (compare with your x.increment)

Details

Take a look at the examples: this is (hopefully!) a lot more straightforward than it might seem. Getting the right spacing of dots on the phylogeny may take some playing around with the fraction and x.increment arguments. It may seem a little strange to set point size using a function, however, this gives you much more flexibility and the ability to (usefully) transform your data.

See Also

comparative.comm traitgram.cc

Examples

Run this code
# NOT RUN {
data(laja)
data <- comparative.comm(invert.tree, river.sites, invert.traits)
plot(data)
plot(data, sites=c("AT", "BP"), fraction=1.5)
settings <- plot(data, sites=c("AT", "BP"), site.col=rainbow(2), fraction=1.5)
plot(data, sites=c("AT", "BP"), site.col=rainbow(2),
fraction=1.2, x.increment=settings$x.increment/4)
#dot.cex isn't as scary as it sounds...
plot(data, site.col=rainbow(2), fraction=1.2, abundance=TRUE, dot.cex=sqrt)
#...or other trivial variants...
abund.sqrt <- function(x) ifelse(x>0, sqrt(x), 0)
plot(data, sites=c("AT", "BP"), site.col=rainbow(2), fraction=1.2,
x.increment=settings$x.increment/4, abundance=TRUE, dot.cex=abund.sqrt)
plot(data, sites=c("AT", "BP"), site.col=rainbow(2), fraction=1.2,
x.increment=settings$x.increment/4, abundance=TRUE, dot.cex=function(x) sqrt(x))
# }

Run the code above in your browser using DataCamp Workspace