June 2016
Beginner to intermediate
1783 pages
71h 22m
English
In this recipe, we will learn how to make a correlation heat map from a matrix of correlation coefficients.
We will only use the base graphics functions for this recipe. So, just open up the R prompt and type in the following code. We will use the genes.csv example dataset for this recipe. So, let's first load it:
genes<-read.csv("genes.csv")Let's make a heat map showing the correlation between genes in a matrix:
rownames(genes)<-genes[,1] data_matrix<-data.matrix(genes[,-1]) pal=heat.colors(5) breaks<-seq(0,1,0.2) layout(matrix(data=c(1,2), nrow=1, ncol=2), widths=c(8,1), heights=c(1,1)) par(mar = c(3,7,12,2),oma=c(0.2,0.2,0.2,0.2),mex=0.5) image(x=1:nrow(data_matrix),y=1:ncol(data_matrix), ...
Read now
Unlock full access