ComplexHeatmap log scale gradient
2
0
Entering edit mode
3.7 years ago
Carab • 0

Hi all,

does anyone know if there is a way to have a Heatmap with ComplexHeatmap and a gradient log scale ?

I used

scale_fill_gradient(trans = "log",low="white", high="darkgreen")

in ggplot, but I can't find anything to use to Heatmap()

Many thanks!!!

log colours complexHeatmap • 3.4k views
ADD COMMENT
0
Entering edit mode

Sorry Carab if you get a lot of notifications about comments in this thread, there are still some glitches in the enw codebase which we are sorting out.

ADD REPLY
1
Entering edit mode
3.7 years ago
ATpoint 85k

I guess you need https://jokergoo.github.io/ComplexHeatmap-reference/book/legends.html#continuous-legends

but if you want log scale you will probably need to transform the data itself. The legend "just plots" what you give the function.

ADD COMMENT
1
Entering edit mode
3.7 years ago
rin ▴ 40

According to the package's vignette, you can specify this as following:

library(circlize)
col_fun = colorRamp2(c(-2, 0, 2), c("green", "white", "red"))
col_fun(seq(-3, 3))
Heatmap(mat, name = "mat", col = col_fun)

That allows you to do the coloring even if your values are not centered evenly around zero.

As for the log, I believe there is no direct argument you can pass on the Heatmap() function, so you might have to do it directly on your matrix.

ADD COMMENT

Login before adding your answer.

Traffic: 1312 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6