I have a list of genes that I'd like to visualize using the DoHeatmap function in Seurat. However, the output of the heatmap does not result in hierarchical clustering and therefore makes it very difficult to interpret. My code is,

 DoHeatmap(object = obj, genes.use = genes), 
          slim.col.label = TRUE, remove.key = T,group.label.rot = F, use.scaled = T)


Is there a way to adjust the DoHeatmap command to rank the cells by the intensity of gene expression? Here's an example output:

enter image description here


1 Answer 1


You need to order the marker matrix (e.g. by avg_logFC) before calling DoHeatMap.

all.markers <- FindAllMarkers(object = obj)
top20 <- all.markers %>% group_by(cluster) %>% top_n(20, avg_logFC)
DoHeatmap(object = obj, genes.use = top20$gene, slim.col.label = TRUE, remove.key = TRUE)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.