Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

color.plot.phylo

Color tip labels based on trait


Description

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

Usage

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

Integrating Phylogenies and Ecology

v1.8.2
GPL-2
Authors
Steven W. Kembel <steve.kembel@gmail.com>, David D. Ackerly <dackerly@berkeley.edu>, Simon P. Blomberg <s.blomberg1@uq.edu.au>, Will K. Cornwell <cornwell@zoology.ubc.ca>, Peter D. Cowan <pdc@berkeley.edu>, Matthew R. Helmus <mrhelmus@wisc.edu>, Helene Morlon <morlon.helene@gmail.com>, Campbell O. Webb <cwebb@oeb.harvard.edu>
Initial release
2020-06-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.