Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




Create a heatmap with R

  • Public
By Rahul Nayak 2460 days ago
bio <- read.csv("ppg2008.csv", sep=",") bio <- bio[order(bio$PTS),] row.names(bio) <- bio$Name bio <- bio[,2:20] bio_matrix <- data.matrix(bio) bio_heatmap <- heatmap(bio_matrix, Rowv=NA, Colv=NA, col = brewer.pal(9, "Blues"), scale="column", margins=c(5,10)) ## #Sample DATA #Name ,G,MIN,PTS,FGM,FGA,FGP,FTM,FTA,FTP,3PM,3PA,3PP,ORB,DRB,TRB,AST,STL,BLK,TO,PF #Genome1 ,79,38.6,30.2,10.8,22,0.491,7.5,9.8,0.765,1.1,3.5,0.317,1.1,3.9,5,7.5,2.2,1.3,3.4,2.3 #Genome2 ,81,37.7,28.4,9.7,19.9,0.489,7.3,9.4,0.78,1.6,4.7,0.344,1.3,6.3,7.6,7.2,1.7,1.1,3,1.7 #Genome3,82,36.2,26.8,9.8,20.9,0.467,5.9,6.9,0.856,1.4,4.1,0.351,1.1,4.1,5.2,4.9,1.5,0.5,2.6,2.3 library(ggplot2) bio <- read.csv("seeTNF_Final", sep="\t") row.names(bio) <- bio$Contig bio <- bio[,2:256] data=as.matrix(bio) head(data) #Rcolorbrewer palette library(RColorBrewer) coul = colorRampPalette(brewer.pal(8, "PiYG"))(25) #heatmap(data) # Use 'scale' to normalize (right) heatmap(data, scale="column") #heatmap(data, scale="column", col = coul)