d3heatmap: D3 Heatmap widget

Description Usage Arguments Source See Also Examples

View source: R/d3heatmap.R

Description

Creates a D3.js-based heatmap widget.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
d3heatmap(
  x,
  main = NULL,
  width = NULL,
  height = NULL,
  show_grid = TRUE,
  anim_duration = 500,
  rng = NULL,
  symm = FALSE,
  Rowv = TRUE,
  Colv = if (symm) "Rowv" else TRUE,
  distfun = dist,
  hclustfun = hclust,
  dendrogram = c("both", "row", "column", "none"),
  reorderfun = function(d, w) reorder(d, w),
  k_row = NULL,
  k_col = NULL,
  kr,
  kc,
  revC = NULL,
  scale = c("none", "row", "column"),
  scale.by.range = FALSE,
  na.rm = TRUE,
  na.color = "#777777",
  na.value = NA,
  key = FALSE,
  keysize = 1,
  key.title = NULL,
  key.location = c("fl", "br", "tr", "tl", "bl"),
  density.info = c("histogram", "none"),
  denscol = NULL,
  digits = 3L,
  cellnote = NULL,
  cellnote_scale = FALSE,
  cellnote_row = NULL,
  cellnote_col = NULL,
  cellnote_val = "Value",
  brush_color = "#0000FF",
  print.values = FALSE,
  notecol = "#222222",
  notecex = 1,
  cex.note,
  theme = NULL,
  col = "RdYlBu",
  breaks = NULL,
  symbreaks = FALSE,
  labRow = rownames(x),
  labCol = colnames(x),
  labColSize = 80,
  labRowSize = 120,
  cexCol = NULL,
  cexRow = NULL,
  srtCol = 60,
  sideCol = 3,
  sideRow = 4,
  xaxis.location,
  yaxis.location,
  xlab = NULL,
  ylab = NULL,
  xaxis_title_font_size = 14,
  yaxis_title_font_size = 14,
  ColSideColors = NULL,
  RowSideColors = NULL,
  RowColorsPalette = NULL,
  ColColorsPalette = NULL,
  RowColorsNames = NULL,
  ColColorsNames = NULL,
  ...
)

Arguments

x

A numeric matrix or data.frame with numeric columns. All non-numeric columns will be filtered out

main

string Plot title. Defaults to NULL.

width

Width in pixels (optional, defaults to automatic sizing).

height

Height in pixels (optional, defaults to automatic sizing).

show_grid

TRUE to show gridlines, FALSE to hide them, or a numeric value to specify the gridline thickness in pixels (can be a non-integer).

anim_duration

Number of milliseconds to animate zooming in and out. For large x it may help performance to set this value to 0.

rng

A vector of two numbers, namely the minimum and maximum value to use when determining the mapping from values to colors. This is useful when the range of values changes between heatmaps, but colors should be the same (optional, defaults to the minimum and maximum of x).

symm

logical indicating if x should be treated symmetrically; can only be true when x is a square matrix.

Rowv

determines if and how the row dendrogram should be reordered. By default, it is TRUE, which implies dendrogram is computed and reordered based on row means. If NULL or FALSE, then no dendrogram is computed and no reordering is done. If a dendrogram, then it is used "as-is", i.e. without any reordering. If a vector of integers, then a dendrogram is computed and reordered based on the order of the vector.

Colv

determines if and how the column dendrogram should be reordered. Has the options as the Rowv argument above and additionally when x is a square matrix, Colv = "Rowv" means that columns should be treated identically to the rows.

distfun

function used to compute the distance (dissimilarity) between both rows and columns. Defaults to dist.

hclustfun

function used to compute the hierarchical clustering when Rowv or Colv are not dendrograms. Defaults to hclust.

dendrogram

character string indicating whether to draw 'none', 'row', 'column' or 'both' dendrograms. Defaults to 'both'. However, if Rowv (or Colv) is FALSE or NULL and dendrogram is 'both', then a warning is issued and Rowv (or Colv) arguments are honored.

reorderfun

function(d, w) of dendrogram and weights for reordering the row and column dendrograms. The default uses statsreorder.dendrogram

k_row, kr

an integer scalar with the desired number of groups by which to color the dendrogram's branches in the rows (uses color_branches)

k_col, kc

an integer scalar with the desired number of groups by which to color the dendrogram's branches in the columns (uses color_branches)

revC

logical indicating if the column order should be reversed for plotting. Default (when missing) - is FALSE, unless symm is TRUE. This is useful for cor matrix.

scale

character indicating if the values should be centered and scaled in either the row direction or the column direction, or none. The default is "none".

scale.by.range

logical indicating whether to scale rows or columns by the range of each row and column. Setting this parameter to TRUE automatically sets na.rm to TRUE

na.rm

logical indicating whether NA's should be removed.

na.color

Color of NA values in heatmap. Defaults to neutral gray.

na.value

numeric indicating where NA's should be substituted to trigger the NA color.

key

Show color key and density information? TRUE/FALSE. Defaults to FALSE

keysize

numeric value indicating the relative size of the key. Will multiple the labRowSize and labColSize. Defaults to 1

key.title

Separate title for color key. Defaults to NULL.

key.location

Required, character Location for color key, either "fl", "br", "tr" "tl", or "bl" for "float", "bottom right", "top right", "top left", and "bottom left". Defaults to "fl", which follows the location of the axis labels.

density.info

Optional, character indicating whether to superimpose a 'histogram' or no plot ('none') on the color-key (legend).

denscol

Optional, character giving the color for the density display specified by 'density.info', defaults to NULL which will fill the bars with the same color as the bin

digits

integer indicating the number of decimal places to be used by round for 'label'.

cellnote

numeric (optional) matrix of the same dimensions as x that has the human-readable version of each value, for displaying to the user on hover. If NULL, then x will be coerced using as.character. If missing, it will use x, after rounding it based on the digits parameter.

cellnote_scale

logical (default is FALSE). IF cellnote is missing and x is used, should cellnote be scaled if x is also scaled?

cellnote_row

character Label to display next to the row value when the user hovers over the cell. If not specified, tries to match the xlab; if no axis title, defaults to "Row".

cellnote_col

character Label to display next to the column value when the user hovers over the cell. If not specified, tries to match the ylab; if no axis title, defaults to "Col".

cellnote_val

character Label to display next to the cell value when the user hovers over the cell. Defaults to "Value".

brush_color

The base color to be used for the brush. The brush will be filled with a low-opacity version of this color. "#RRGGBB" format expected.

print.values

logical Show the values inside the cells. Defaults to FALSE.

notecol

character name or hex specifying the color of the values printed inside the cells

notecex, cex.note

numeric scalar of 12 to determine pixel size of printed cell values. inside the cells. If not specified, the minimum font size between the x and y axes.

theme

A custom CSS theme to use. Currently the only valid values are "" and "dark". "dark" is primarily intended for standalone visualizations, not R Markdown or Shiny.

col

Either a colorbrewer2.org palette name (e.g. "YlOrRd" or "Blues"), or a vector of colors to interpolate in hexadecimal "#RRGGBB" format, or a color interpolation function like colorRamp.

breaks

integer Either a numeric vector indicating the splitting points for binning x into colors, or a integer number of break points to be used, in which case the break points will be spaced equally between min(x) and max(x).

symbreaks

logical Arrange color bins symmetrically around zero?

labRow

character vectors with row labels to use (from top to bottom); default to rownames(x).

labCol

character vectors with column labels to use (from left to right); default to colnames(x).

labColSize

Size of axes, in pixels.

labRowSize

Size of axes, in pixels.

cexCol

Font size of column labels, as a scalar to '12px' font. Default to 0.2 + 1/log10(ncol(x)).

cexRow

Font size of row labels, as a scalar to '12px' font size. Defaults to 0.2 + 1/log10(nrow(x)).

srtCol

Angle of axis labels. Defaults to 60. Maximum of 90 (vertical), minimum of 25.

sideCol, xaxis.location

3 or 1, for "bottom" or "top", which side column labels display. Defaults to 3 ("bottom"). For xaxis.location use "bottom" or "top".

sideRow, yaxis.location

2 or 4, for "left" or "right", which side row labels display. Defaults to 4 ("right"). For yaxis.location use "left" or "right".

xlab

Title text of x axis

ylab

Title text of y axis

xaxis_title_font_size

Font size of x axis title in pixels. Defaults to 14.

yaxis_title_font_size

Font size of y axis title in pixels. Defaults to 14.

ColSideColors

(optional) 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 columns of x. ColIndividualColors, from heatmap.2, can also be used

RowSideColors

(optional) character vector of length nrow(x), or matrix with rows equal to nrow(x), containing the color names for a vertical side bar that may be used to annotate the rows of x. RowIndividualColors, from heatmap.3, can also be used

RowColorsPalette

a palette of colors to use for RowSideColors if passing a non-color matrix

ColColorsPalette

a palette of colors to use for ColSideColors if passing a non-color matrix

RowColorsNames

the names of the variables for RowSideColors. Overrides colnames(RowSideColors)

ColColorsNames

the names of the variables for ColSideColors. Overrides rownames(ColSideColors) with rows equal to nrow(x), containing the color names for a vertical side bar that may be used to annotate the rows of x.

...

a catch for undocumented features or unused arguments from heatmap.2 or heatmap.3, to enable direct use of those formulations in d3heatmap

Source

The interface was designed based on heatmap and heatmap.2

See Also

heatmap, heatmap.2

Examples

1
2
3
4
5
6
## Not run: 

d3heatmap(mtcars, scale = "column", col = "Blues")


## End(Not run)

rstudio/d3heatmap documentation built on May 26, 2021, 10:16 p.m.