# Overview

pavo is an R package developed with the goal of establishing a flexible and integrated workflow for working with spectral and spatial colour data. It includes functions that take advantage of new data classes to work seamlessly from importing raw spectra and images, to visualisation and analysis. It provides flexible ways to input spectral data from a variety of equipment manufacturers, process these data, extract variables, and produce publication-quality figures.

pavo was written with the following workflow in mind:

1. Organise data by importing and processing spectral and image data (e.g., to remove noise, negative values, smooth curves, etc.).
2. Analyse the resulting files, using spectral analyses of shape (hue, saturation, brightness), visual models based on perceptual data, and/or spatial adjacency and boundary strength analyses.
3. Visualise the output, with multiple options provided for exploration and analysis.

In the included vignettes we begin by detailing the importing, processing and visualisation of spectral and image data, before moving on to discussion of the flexible analyses of such data that pavo allows. Our hope is to demonstrate the flexibility of pavo, and to provide a cohesive, reproducible workflow for colour pattern analysis within R. As always, the development version of pavo can be found on github, while the stable release is available via CRAN.

# Classes and Attributes

To enable the comprehensive workflow of pavo, we’ve implemented an expanded class system. Spectra will be of class rspec as long as we use one of pavo’s spectral import or processing functions, or explicitly convert an object using as.rspec(). Similarly, images will be of class rimg when imported via getimg(), or if converted using as.rimg(). The results of vismodel() are objects of class vismodel and the results of colspace() are, unsurprisingly, objects of class colspace. Most of these classes inherit from data.frame, and contain a suite of attributes that describe the object’s characteristics (e.g. options used in visual modelling such as the selected visual system and illuminant, and properties of the modelled colourspace). These are easily viewed using the summary function (on any rspec, rimg, vismodel, or colspace object), which will return the attributes and summary data (where appropriate) in a readable format.

# Suggestions and Assistance

For suggestions, assistance and/or bug reports, we suggest getting in touch by sending an email to , which is a public mailing list for all things pavo. If you have a bug to report, we’d appreciate it if you could also include a reproducible example when possible. Users familiar with git may prefer to open an issue on the project’s github page, or to make a pull-request directly.

# Citation of methods implemented in pavo

Most of the methods implemented in pavo have been thoroughly described in their original publications, to which users should refer for details and interpretation. For reflectance shape variables (“objective colourimetrics”) and their particular relation to signal production and perception, see Andersson and Prager (2006) and Montgomerie (2006). Visual models based on photon catches and receptor noise are detailed in Vorobyev et al. (1998) and Vorobyev et al. (1998), and photoreceptor sensitivity curve estimation in Govardovskii et al. (2000) and Hart and Vorobyev (2005). For tetrahedral colourspace model implementations and variable calculations, see Endler and Mielke (2005) and Stoddard and Prum (2008), and for colour volume overlap see Stoddard and Prum (2008) and Stoddard and Stevens (2011). Adjacency and boundary strength analyses are described in Endler (2012) and Endler, Cole, and Kranz (2018), while overall pattern contrast is detailed in Endler and Mielke (2005). Users of the functions that apply these methods must cite the original sources as appropriate, along with pavo itself.

# Acknowledgements

We would like to thank Matthew D. Shawkey and Stephanie M. Doucet for insights and support, and Jarrod D. Hadfield and Mary Caswell Stoddard for sharing code that helped us develop some of pavo’s capabilities.

# References

Andersson, Staffan, and Maria Prager. 2006. “Quantification of Coloration.” In Bird Coloration, Volume 1: Mechanisms and Measurements, edited by Geoffrey E. Hill and Kevin J. McGraw, 1:640. Bird Coloration. Harvard University Press.

Endler, John A. 2012. “A Framework for Analysing Colour Pattern Geometry: Adjacent Colours.” Biological Journal of the Linnean Society 107 (2): 233–53. https://doi.org/10.1111/j.1095-8312.2012.01937.x.

Endler, John A., Gemma L. Cole, and Alexandrea M. Kranz. 2018. “Boundary Strength Analysis: Combining Colour Pattern Geometry and Coloured Patch Visual Properties for Use in Predicting Behaviour and Fitness.” Edited by Simon Blomberg. Methods in Ecology and Evolution, August. https://doi.org/10.1111/2041-210X.13073.

Endler, John A., and Paul W. Mielke. 2005. “Comparing Entire Colour Patterns as Birds See Them.” Biological Journal of the Linnean Society 86 (4): 405–31. https://doi.org/10.1111/j.1095-8312.2005.00540.x.

Govardovskii, Victor I., Nanna Fyhrquist, Tom Reuter, Dmitry G. Kuzmin, and Kristian Donner. 2000. “In Search of the Visual Pigment Template.” Visual Neuroscience 17 (4): 509–28. https://www.cambridge.org/core/journals/visual-neuroscience/article/in-search-of-the-visual-pigment-template/A4738E821720092B7F5A233C4AB4962B.

Hart, Nathan S., and Misha Vorobyev. 2005. “Modelling Oil Droplet Absorption Spectra and Spectral Sensitivities of Bird Cone Photoreceptors.” Journal of Comparative Physiology A 191 (4): 381–92. https://doi.org/10.1007/s00359-004-0595-3.

Montgomerie, Robert. 2006. “Analyzing Colors.” In Bird Coloration, Volume 1: Mechanisms and Measurements, edited by Geoffrey E. Hill and Kevin J. McGraw, 1:640. Bird Coloration. Harvard University Press.

Stoddard, Mary Caswell, and Richard O. Prum. 2008. “Evolution of Avian Plumage Color in a Tetrahedral Color Space: A Phylogenetic Analysis of New World Buntings.” The American Naturalist 171 (6): 755–76. https://doi.org/10.1086/587526.

Stoddard, Mary Caswell, and Martin Stevens. 2011. “Avian Vision and the Evolution of Egg Color Mimicry in the Common Cuckoo.” Evolution 65 (7): 2004–13. https://doi.org/10.1111/j.1558-5646.2011.01262.x.

Vorobyev, Misha, Daniel Colaco Osorio, Andrew T. D. Bennett, N. Justin Marshall, and Innes C. Cuthill. 1998. “Tetrachromacy, Oil Droplets and Bird Plumage Colours.” Journal of Comparative Physiology A 183 (5): 621–33. https://doi.org/10.1007/s003590050286.