hmSideColors: Modify axis options

Description Usage Arguments Source See Also Examples

View source: R/hmSidecolors.R

Description

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

Usage

1
2
3
4
5
6
7
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## 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 May 26, 2021, 10:16 p.m.