color.plot.phylo: Color tip labels based on trait

Description Usage Arguments Details Value Author(s)

Description

Plots a phylogeny with tip labels colored to indicate continuous or discrete trait values

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  color.plot.phylo(phylo, df, trait, taxa.names,
                    num.breaks = ifelse(is.factor(df[,trait]),
                        length(levels(df[,trait])), 12),
                    col.names = rainbow(ifelse(length(num.breaks) > 1,
                        length(num.breaks) - 1, num.breaks)),
                    cut.labs = NULL,
                    leg.title = NULL,
                    main = trait,
                    leg.cex = 1,
                    tip.labs = NULL,
                    ...)
        

Arguments

phylo

An object of class phylo

df

A dataframe containing the traits to be plotted

trait

A string representing the name of column in the dataframe to be plotted

taxa.names

A string representing the name of column in the dataframe that contains the names of the taxa

num.breaks

For continuous traits, the number of bins to separate the data into

col.names

A vector of colors to use for tip labels

leg.title

A title for the tip color legend

main

A main title for the plot

cut.labs

A main title for the plot

leg.cex

A main title for the plot

tip.labs

A main title for the plot

...

Additional argument to pass to the plot.phylo function

Details

If if trait is a factor then each level of the factor is plotted with the corresponding col.names value (if length(num.breaks) > length(col.names) colors are recycled.) If trait is not a factor then it is assumed to be continuous and trait is evenly divided into num.breaks levels.

Value

The command is invoked for its side effect, a plot of the phylo with tips colored based on trait

Author(s)

Peter Cowan <pdc@berkeley.edu>


picante documentation built on July 1, 2020, 10:57 p.m.