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!!!
2 answers
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.
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.
Log in to answer this question.
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.