hmSideColors: Modify axis options

View source: R/hmSidecolors.R

hmSideColorsR Documentation

Modify axis options

Description

Provides options for modifying the x and y axes of a D3 Heatmap widget

Usage

hmSideColors(
  d3heatmap,
  axis = c("x", "y", "row", "column"),
  side.colors,
  palette,
  names
)

Arguments

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.

Source

The interface was inspired by dygraphs

See Also

heatmap, heatmap.2

Examples

## 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)


rstudio/d3heatmap documentation built on Nov. 18, 2024, 9:20 a.m.