This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to split a heatmap at specific row?

I am trying to build a heatmap in R. I wanted to split the heatmap at specific rows. For example my matrix is as:

ID A B C

FD_1 0.3 0.2 1

FD_2 0.4 1 0.9

FD_3 0.6 0.8 0.2

FS_1 0.3 0.2 1

FS_2 0.4 1 0.9

FS_3 0.6 0.8 0.2

FS_4 0.4 1 0.9

FS_5 0.6 0.8 0.2

FE_1 0.3 0.2 1

FE_2 0.4 1 0.9

FE_3 0.6 0.8 0.2

FE_4 0.4 1 0.9

I want to make a heatmap that includes 3 slice: one for 3 FD, one for 5 FS and one for 4 FE. And label each slice with their name as FD, FS and FE.

I'm using this code:

Heatmap(M_matrix, name = "level", row_split = M_matrix$ID)

But it is not working!

Any suggestion? Thanks

r heatmap split

1 answer

ComplexHeatmap should help you. Otherwise subset your data frame into three DFs and make threes separate heatmaps and use grid functionality of r.

Log in to answer this question.