Learn R Programming

pavo (version 0.3-1)

aggplot: Plot aggregated reflectance spectra

Description

Combines and plots spectra (by taking the average and the standard deviation, for example) according to an index or a vector of identities.

Usage

aggplot(rspecdata, by = NULL, FUN.center = mean,
    FUN.error = sd, lcol = NULL, shadecol = NULL,
    alpha = 0.2, ...)

Arguments

rspecdata
(required) data frame containing the spectra to be manipulated and plotted.
by
(required) either a single value specifying the range of spectra within the data frame to be combined (for example, by = 3 indicates the function will be applied to groups of 3 consecutive columns in the spectra data frame) or a vecto
FUN.center
the function to be applied to the groups of spectra, calculating a measure of central tendency (defaults to mean).
FUN.error
the function to be applied to the groups of spectra, calculating a measure of variation (defaults to sd).
lcol
color of plotted lines indicating central tendency.
shadecol
color of shaded areas indicating variance measure.
alpha
transparency of the shaded areas.
...
additional graphical parameters to be passed to plot.

Value

  • Plot containing the lines and shaded areas of the groups of spectra.

References

Montgomerie R (2006) Analyzing colors. In: Hill G, McGraw K (eds) Bird coloration. Harvard University Press, Cambridge, pp 90-147.

Examples

Run this code
data(sicalis)
bysic <- gsub("^ind[0-9].",'',names(sicalis)[-1])
aggplot(sicalis,bysic)
aggplot(sicalis,bysic, shade=spec2rgb(sicalis),lcol=1)
aggplot(sicalis,bysic,lcol=1, FUN.error=function(x)sd(x)/sqrt(length(x)))

Run the code above in your browser using DataLab