phylo.discrete_trait_heatmap | R Documentation |
This function adds a discrete trait heatmap to a phylogeny produced by phylo.discrete_trait_OTU (or any ggplot2/ggtree plot).
phylo.discrete_trait_heatmap(
plot,
phylo,
trait_data_frame,
color_palette = viridis(option = "viridis", n = length(unique(as.vector(apply(X =
trait_data_frame, MARGIN = 2, FUN = function(x) unique(x)))))),
font_size = 2,
font_angle = 90,
font_offset_y = 0,
heatmap_width = 1,
heatmap_offset = 0.5
)
plot |
A ggplot2/ggtree plot |
phylo |
phylo object which was used to construct plot. |
trait_data_frame |
Data frame, where each row corresponds to a tip in the phylogeny, and each column corresponds to a discrete trait. Row names should match phylogeny tip labels exactly, and column names should correspond to the trait name. Cells should contain character values corresponding to the trait(s) (equivalent values in the data frame will be assigned the same color, i.e., all cells with "0" will be the same color, all cells with "cat" will be another color, etc.). |
color_palette |
Vector of heatmap cell color(s). Defaults to one color per unique cell value using the viridis color scale. |
font_size |
Size of trait names. Defaults to 2. |
font_angle |
Angle of trait names. Defaults to 90. |
font_offset_y |
Vertical offset of trait names. Defaults to 0. |
heatmap_width |
Width of heatmap, compared to width of tree. Defaults to 1. |
heatmap_offset |
Offset of heatmap to tree. Defaults to 0.5. |
A ggplot2 object
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.