add.color.bar: Add color bar to a plot

View source: R/plotBranchbyTrait.R

add.color.barR Documentation

Add color bar to a plot

Description

This function adds a color gradient legend to an existing plot.

Usage

add.color.bar(leg, cols, title=NULL, lims=c(0,1), digits=1, prompt=TRUE,
   lwd=4, outline=TRUE, ...)

Arguments

leg

numerical value for the length of the legend.

cols

colors for the legend.

title

text to plot above the bar.

lims

range for the bar.

digits

digits for plotted numbers.

prompt

logical value indicating whether the location of the legend should be obtained interactively.

lwd

width of the plotted bar.

outline

logical value indicated whether or not to outline the plotted color bar with a 1 pt line.

...

optional arguments including: x x-coordinate of the legend (if prompt=FALSE); y y-coordinate of the legend; subtitle optional legend subtitle; direction direction of the color bar (i.e., increase from left to right or from right to left); and fsize, font size for the legend text.

Details

This function was designed to add a color bar to a plot created by plotBranchbyTrait. A color bar can be added by clicking on a location within the plot (when prompt=TRUE) or by setting prompt=FALSE and supplying x & y coordinates for the object.

The function is also used internally by S3 methods plot.contMap and plot.densityMap, as well as by errorbar.contMap.

Author(s)

Liam Revell liam.revell@umb.edu

References

Revell, L. J. (2013) Two new graphical methods for mapping trait evolution on phylogenies. Methods in Ecology and Evolution, 4, 754-759.

Revell, L. J. (2024) phytools 2.0: an updated R ecosystem for phylogenetic comparative methods (and other things). PeerJ, 12, e16505.

See Also

contMap, densityMap, errorbar.contMap, plotBranchbyTrait


phytools documentation built on June 22, 2024, 10:39 a.m.