Map macroevolutionary rates to colors
Description
Maps macroevolutionary rates to a set of NCOLORS
.
Usage
1 2  assignColorBreaks(rates, NCOLORS = 64, spex = "s", logcolor = FALSE,
method = c("linear", "quantile", "jenks"), JenksSubset = NULL)

Arguments
rates 
A numeric vector of phenotypic rates or a list of numeric vectors of speciation and extinction rates. 
NCOLORS 
An integer number of colors to use for the mapping. Larger numbers do not necessarily result in smoother looking color ramps. The default is 64 and is probably sufficient for most purposes. 
spex 
A character string. "s" means that speciation rates are used
to make the map, "e" means that extinction rates are used. "netdiv"
means that diversification rates are used. Ignored for 
logcolor 
Logical. Should the natural logarithm of rates be used for the color map. 
method 
Determines how the color breaks are created. See Details. 
JenksSubset 
Number of regularly spaced samples to subset from

Details
If method = "quantile"
macroevolutionary rates are binned
into NCOLORS+1
percentiles and rates in each bin are mapped to
a color determined by the pal
argument in plot.bammdata
.
Alternatively, if method = "linear"
macroevolutionary rates are
binned into NCOLORS+1
equal length intervals between the
minimum and maximum.
If method = "jenks"
, macroevolutionary rates are binned into
NCOLORS+1
categories, according to the Jenks natural breaks
classification method. This method is borrowed from the field of
cartography, and seeks to minimize the variance within categories,
while maximizing the variance between categories.
The Jenks natural breaks method was ported to C from code found in the classInt R package.
Value
A numeric vector of rate percentiles/intervals.
Author(s)
Mike Grundler, Pascal Title
See Also
plot.bammdata
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  data(whales, events.whales)
ed < getEventData(whales, events.whales, burnin = 0.2, nsamples = 500)
ed < dtRates(ed, 0.01)
colors < assignColorBreaks(ed$dtrates$rates, spex="s") #speciation rates
#colors < assignColorBreaks(ed$dtrates$rates[[1]])
#this also works for speciation rates
plot(ed, colorbreaks = colors, spex="s")
colors < assignColorBreaks(ed$dtrates$rates, spex="netdiv")
#diversification rates
#colors < assignColorBreaks(ed$dtrates$rates[[1]]  ed$dtrates$rates[[2]])
#this also works for diversification rates
plot(ed, colorbreaks = colors, spex="netdiv")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.