Monthly Archives: July 2016

An example script of creating a heatmap using the heatmap.2 function in R


# Just copy all below into R to test

# Notes: the styles of “double quotes” when copied may change and make the script not run normally, but you can manually change the “double quotes”.

breaks = 20 # number of colors
my_palette <- colorRampPalette(c(“green”,”red”))(n =breaks-1) # self-define and discretize color maps
heatmap.2(X,Colv = NA,col=my_palette,breaks = breaks,”none”,trace = “none”,scale=”none”)