This is a test version of Biostars. For the public version, visit https://www.biostars.org.
heatmap issue

heatmap

i wanted to align my controls in one side and patients on the other side.. how can i do it? my code:

heatmap(mat,cluster_rows = T, cluster_columns = T, column_lables=colnames(mat), name="z-score")
heatmap deseq2

1 answer

Your controls clearly show variable expression for the genes you're plotting so to get them to stick together on the left, you would need to set cluster_columns=F and manually order your matrix:

mat <- mat[,c(paste0("C", 1:9), paste0("P", 1:9))]

Alternatively, you can split your data into two matrices of controls and patients and then use grid or cowplot or a similar package to plot the two heatmaps together.

Log in to answer this question.