table <- as.matrix(read.table("heatmap_example_gcba815_100.txt", header=TRUE, row.names=1, sep = "\t")) table.sub <- subset(table, select = c(sample_1,sample_2,sample_3,sample_4)) library() install.packages("pheatmap") library(pheatmap) hmap <- heatmap(table, Rowv=TRUE, Colv=TRUE, col = cm.colors(256), scale="column", margins=c(5,20)) #different color mode cm.colors -> heat.colors hmap <- heatmap(table, Rowv=TRUE, Colv=TRUE, col = heat.colors(256), scale="column", margins=c(5,20)) #Order by a column table.sub[order(table.sub[,4]),] #select only the rows with value of first column greater than 4 heat_set<-table.sub[table.sub[,1]>4,] library("gplots") library("pheatmap") pheatmap(heat_set, cellwidth = 6, cellheight = 10,color = colorRampPalette(c("red", "darkgreen", "green"))(100), main = "Example heatmap",treeheight_row=60, treeheight_col=10,fontsize=5, fontsize_row=5,margins=c(5,10),border_color=NA, file="heatmap_example_gcba85.pdf") dev.off()