Category Archives: R

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”.

rm(list=ls())
require(gplots)
X=matrix(rnorm(120),nrow=20)
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,density.info=”none”,trace = “none”,scale=”none”)

Venn diagram in R

# personal notes

library(VennDiagram)
data=list(A=c(1,2,3,4,5,6),B=c(3,4,5,6,7),C=c(5,6,7,8,9,10))    # demo data
venn.diagram(data,”vennFigure.tiff”,fill = c(“cornflowerblue”, “green”, “yellow”))  # venn diagram saved to a file