[R] Heatmap help

André Luis Neves andrluis at ualberta.ca
Fri Mar 3 19:59:11 CET 2017


Dear all,

I was wondering if you could help me to construct a heat map, in which the
columns are sorted by sample type (A first and then B).
My reproducible example below runs, but the columns of the heatmap are not
organized in the way I would like because it has first sampleA, SampleB,
sampleA, and then sampleB.


A = matrix(rnorm(20), 5,8)
A
colnames(A) <- c ("Sample1.A", "Sample2.B", "Sample3.A", "Sample4.B",
"Sample5.A", "Sample6.B", "Sample7.A", "Sample8.B")
A
rownames(A) <- c ("protein1","protein2", "protein3", "protein4","protein5")
A

heatmap.2(A, dendrogram="col", Rowv = colnames(A), tracecol =
NA,col=bluered(64), sub = "",
          distfun = function(y) dist(y, method = "euclidean"), hclustfun =
function(y) hclust(y, method = "median"),
          scale = "row",cexCol = 1, cexRow = 0.9, ylab = "Enzymes", xlab =
"Samples", margins = c(9,9), keysize = 1,
          main='Test')



​Thanks.

-- 
Andre

	[[alternative HTML version deleted]]



More information about the R-help mailing list