graph - Group variables by clusters on heatmap in R -
i trying reproduce first figure of this paper on graph clustering : here sample of adjacency matrix: data=cbind(c(48,0,0,0,0,1,3,0,1,0),c(0,75,0,0,3,2,1,0,0,1),c(0,0,34,1,16,0,3,0,1,1),c(0,0,1,58,0,1,3,1,0,0),c(0,3,16,0,181,6,6,0,2,2),c(1,2,0,1,6,56,2,1,0,1),c(3,1,3,3,6,2,129,0,0,1),c(0,0,0,1,0,1,0,13,0,1),c(1,0,1,0,2,0,0,0,70,0),c(0,1,1,0,2,1,1,1,0,85)) colnames(data)=letters[1:nrow(data)] rownames(data)=colnames(data) and these commands obtain following heatmap: library(reshape) library(ggplot2) data.m=melt(data) data.m[,"rescale"]=round(rescale(data.m[,"value"]),3) p=ggplot(data.m,aes(x1, x2))+geom_tile(aes(fill=rescale),colour="white") p=p+scale_fill_gradient(low="white",high="black") p+theme(text=element_text(size=10),axis.text.x=element_text(angle=90,vjust=0)) this similar plot on left of figure 1 above. differences (1) nodes not ordered randomly alphabetically, , (2) instead of having binary black/white pixel...