I am plotting a set of genes belonging to three groups A, B, C, and the heatmap orders them such as C, A, B. (I have read this is due to that it plots on the right the cluster with the strongest similarity). I would like to order the clusters to the groups are seen as A, B, C (therefore reorganising the order of the cluster branches.
> pheatmap(mat, annotation_col = anno, color = colorRampPalette(c("blue", "white", "red"))(50),show_rownames = F)
I have tried adding cluster_cols = FALSE
. This orders the columns in sample number order (which is similar to dendrogram) but ignores the clustering which I am interested to see (ie. samples 1419 and 1421 are clustered together, but when using cluster_cols = FALSE
sample 1420 shows in the middle.
pheatmap(mat, annotation_col = anno, cluster_cols = FALSE, color = colorRampPalette(c("blue", "white", "red"))(50),show_rownames = F)
is there any function I could use to specify (even manually) the order of the columns maintaining the clusters?