Open chiwwong opened 1 year ago
You cannot mix the use of rowAnnotation()
and columnAnnotation()
. You can do:
Heatmap(mat, bottom_annotation = columnAnnotation(test = anno_text(gsub("[a-z]*", "", colnames(mat))))) +
rowAnnotation(test = anno_text(gsub("[a-z]*", "", rownames(mat))))
Or
Heatmap(mat,
right_annotation = rowAnnotation(test = anno_text(gsub("[a-z]*", "", rownames(mat)))),
bottom_annotation = columnAnnotation(test = anno_text(gsub("[a-z]*", "", colnames(mat)))))
I want to customize the column and row names of the heatmap. For some reason (because the real dataset comprises duplicated row/ column names which are not allowed by R), I need to add some prefixes to the row/ column names. However, I want to omit these prefixes when plotting the graph.
I think re-annotate the row names work perfectly using code
I used the toy dataset at the beginning of chapter 2.
However, I tried to use the
columnAnnotation()
, it always gave me an error message:I have also tried several variants, but have had no luck.