Learn R Programming

pavo (version 2.3.0)

voloverlap: Colour volume overlap

Description

Calculates the overlap between the volumes defined by two sets of points in cartesian space.

Usage

voloverlap(
  colsp1,
  colsp2,
  plot = FALSE,
  interactive = FALSE,
  col = c("blue", "red", "darkgrey"),
  fill = FALSE,
  new = TRUE,
  montecarlo = NULL,
  nsamp = NULL,
  psize = NULL,
  lwd = 1,
  ...
)

Arguments

colsp1, colsp2

(required) data frame, possibly a result from the colspace() function, containing values for the 'x', 'y' (and possibly 'z') coordinates as columns (labeled as such)

plot

logical. Should the volumes and points be plotted? (defaults to FALSE). This only works for tetrahedral colourspaces at the moment.

interactive

logical. If TRUE, uses the rgl engine for interactive plotting; if FALSE then a static plot is generated.

col

a vector of length 3 with the colours for (in order) the first volume, the second volume, and the overlap.

fill

logical. should the two volumes be filled in the plot? (defaults to FALSE)

new

logical. Should a new plot window be called? If FALSE, volumes and their overlap are plotted over the current plot (defaults to TRUE).

montecarlo

deprecated argument

nsamp

deprecated argument

psize

deprecated argument

lwd

if plot = TRUE, sets the line width for volume grids.

...

additional arguments passed to the plot. See vol()

Value

Calculates the overlap between the volumes defined by two set of points in colourspace. The volume from the overlap is then given relative to:

  • vsmallest the volume of the overlap divided by the smallest of that defined by the the two input sets of colour points. Thus, if one of the volumes is entirely contained within the other, this overlap will be vsmallest = 1.

  • vboth the volume of the overlap divided by the combined volume of both input sets of colour points.

References

Stoddard, M. C., & Prum, R. O. (2008). Evolution of avian plumage color in a tetrahedral color space: A phylogenetic analysis of new world buntings. The American Naturalist, 171(6), 755-776.

Stoddard, M. C., & Stevens, M. (2011). Avian vision and the evolution of egg color mimicry in the common cuckoo. Evolution, 65(7), 2004-2013.

Maia, R., White, T. E., (2018) Comparing colors using visual models. Behavioral Ecology, ary017 10.1093/beheco/ary017

Examples

Run this code
# NOT RUN {
data(sicalis)
tcs.sicalis.C <- subset(colspace(vismodel(sicalis)), "C")
tcs.sicalis.T <- subset(colspace(vismodel(sicalis)), "T")
tcs.sicalis.B <- subset(colspace(vismodel(sicalis)), "B")
voloverlap(tcs.sicalis.T, tcs.sicalis.B)
voloverlap(tcs.sicalis.T, tcs.sicalis.C, plot = TRUE)
voloverlap(tcs.sicalis.T, tcs.sicalis.C, plot = TRUE, col = seq_len(3))
# }

Run the code above in your browser using DataLab