Learn R Programming

bvbiome (version 0.99.18)

dendroribbons: Image plot of phenotypic data across hierarchically organized samples.

Description

This function creates rows of colored ribbons representing phenotypic state, with a dendrogram providing column structure.

Usage

dendroribbons(ddr, data, colschm = brewer.pal(9, "OrRd"),
    dheight = 0.2, dwidth = 0.8, colmissing = "lightgrey",
    main = character())

Arguments

ddr
An instance of hclust, as produced by as.hclust, or an object of class phylo defined in the ape package.
data
A data.frame of phenotypic values, with samples (rows) in order.dendrogram order.
colschm
A character() vector of color values describing the scheme for ribbon images. The default is a color-blind safe sequential scheme, with dark represent large values.
dheight
A numeric(1) value giving the fraction of the height final image occupied by the dendrogram.
dwidth
A numeric(1) value giving the fraction of the width of the final image occupied by the dendrogram.
colmissing
A character(1) value indicating the color of missing values.
main
A character(1) title for the overal plot.

Value

  • The function is evaluated for its side effect, an image with appropriate annotations.

Examples

Run this code
## data input, 20% most abundant taxa, asinh-transformed counts
data(cc)
log5 <- function(x) log(.5 + x)
cc1 <- normalize(trimq(cc, taxonQ=.7), transform=log5)

## select and pre-process metadata to plot
df <- as.data.frame(samples(cc))
df$pH <- (5 * ((.25 + df$pH) %/% .5)) / 10

## create dendrogram, in desired order
ddr <- as.dendrogram(hclust(dist(t(communities(cc1)))))
o <- with(samples(cc1), order(nugent_2_group))
ddr <- rev(reorder(ddr, o))
df <- df[order.dendrogram(ddr),]

## plot
dendroribbons(ddr, df)

Run the code above in your browser using DataLab