'pheatmap r- annotation legend not showing all values
when drawing annotation, not all of the clusters are shown (only 4 out of 8). How can I solve it and see all the colors with their names? Thanks!
The data is a correlation map (cor_martix), that I extracted the clusters that created by pheatmap, and make an annotation from them.
code:
chosen_k = 4
res = pheatmap(mat = cor_martix, breaks=seq(-1, 1, length.out=101))
myannotation = as.data.frame(cutree(res$tree_row,k = chosen_k)) #extract k clusters
names(myannotation)[1] = "cluster"
palette1 <- rainbow(chosen_k,alpha = 0) #make colors
ann_colors = list (cluster = palette1) #make annotation colors
pheatmap(mat = cor_martix, breaks=seq(-1, 1, length.out=101),annotation_col = myannotation, annotation_colors =ann_colors)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|