hmSideColors | R Documentation |
Provides options for modifying the x and y axes of a D3 Heatmap widget
hmSideColors(
d3heatmap,
axis = c("x", "y", "row", "column"),
side.colors,
palette,
names
)
d3heatmap |
a d3heatmap object created from the d3heatmap() |
axis |
Name of the axis to modify; either "x", "y", "row", or "column" |
side.colors |
character vector of length ncol(x), or matrix with columns equal to ncol(x), containing the color names for a horizontal side bar that may be used to annotate the rows or columns of x. |
palette |
a palette of colors to use for side colors if passing a non-color matrix |
names |
the names of the variables for the side colors. |
The interface was inspired by dygraphs
heatmap, heatmap.2
## Not run:
rsc <- matrix(rep_len(c('good', 'bad', 'ugly'), length.out = 64), ncol = 2)
rsccols <- c('red', 'white', 'blue')
rscnames <- c('Row 1', 'Row 2')
csc <- matrix(rep_len(c('first', 'second', 'third', 'fourth', 'fifth'), length.out = 33), nrow = 3)
csccols <- c('orange', 'blue', 'grey', 'green', 'red')
cscnames <- c('Column 1', 'Column 2', 'Column 3')
d3heatmap(mtcars, key = TRUE, scale = 'column') %>%
hmSideColors(axis = 'column', side.colors = csc,
palette = csccols, names = cscnames) %>%
hmSideColors(axis = 'y', side.colors = rsc,
palette = rsccols, names = rscnames)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.