# correlation example for 0 - 1
# imagine cor_vals is a set of correlation values
library(ComplexHeatmap)
= 0
cor_start = 1
cor_end = 20
n_break = circlize::colorRamp2(seq(cor_start,
viridis_map
cor_end, length.out = n_break),
::viridis(n_break))
viridis
Heatmap(cor_vals,
col = viridis_map,
...)
Normal Incrementing Data
Nine times out of ten, you probably need just one of the {viridis}
colormaps for values that are increasing in one direction. For example, correlation values that are all positive, or abundances from RNA-Seq, etc. If you want to use them with {ComplexHeatmap}
, you do so like this:
Divergent Data
In this case, you have values where a central value is a natural point that you want to highlight things above and below that value. Examples include correlations that include negative and positive correlations, log-fold-changes above and below zero. In this case, I prefer the {scico}
package with the vik
colormap.
= -1
cor_start = 1
cor_end = 20
n_break
= circlize::colorRamp2(seq(cor_start
scico_map
cor_end,length.out = n_break),
::scico(n_break,
scicopalette = "vik"))
Heatmap(cor_vals,
col = scico_map,
...)
Other Colormaps?
Do you have other suggestions for colormaps, both incremental and divergent? Please let me know in the comments!
Reuse
Citation
@online{mflight2022,
author = {Robert M Flight},
title = {Heatmap {Colormaps!}},
date = {2022-01-31},
url = {https://rmflight.github.io/posts/2022-01-31-heatmap-colormaps},
langid = {en}
}