R Codes: Understanding the arguments of heatmap.2 {gplots}
R heatmap
Shaojun Xie
Thursday, November 19, 2015
This is an example to show you how to draw a heatmap and also show you how each parameter work.
library(gsheet)
a<-gsheet2tbl('https://docs.google.com/spreadsheets/d/1MUPsoYsxHwoQFEjsq_XlTvxAK6uA0QyuboACvMg2pVo/pubhtml')
b<-unlist(a[,1])
rownames(a)<-b
a$id<-NULL
library(gplots)
heatmap.2(as.matrix(a))
Arguments “scale” is the chrater string indicating whether to draw ‘none’, ‘row’, ‘column’ or ‘both’ dendrograms. Defaults to ‘both’. However, if Rowv (or Colv) is FALSE or NULL and dendrogram is ‘both’, then a warning is issued and Rowv (or Colv) arguments are honoured.
heatmap.2(as.matrix(a),scale="row")
Argument “col” is colors used for the image. Defaults to heat colors (heat.colors).
heatmap.2(as.matrix(a),scale="row",col=bluered(256))
Argument “trace”: character string indicating whether a solid “trace” line should be drawn across ‘row’s or down ’column’s, ’both’ or ‘none’. The distance of the line from the center of each color-cell is proportional to the size of the measurement. Defaults to ‘column’.
heatmap.2(as.matrix(a),scale="row",col=bluered(256),trace="none")
Arguments: labRow, labCol
character vectors with row and column labels to use; these default to rownames(x) or colnames(x), respectively.
character vectors with row and column labels to use; these default to rownames(x) or colnames(x), respectively.
heatmap.2(as.matrix(a),scale="row",col=bluered(256),trace="none",labRow=NA)
key: logical indicating whether a color-key should be shown.
heatmap.2(as.matrix(a),scale="row",col=bluered(256),trace="none",labRow=NA, key=F)
density.info: character string indicating whether to superimpose a ‘histogram’, a ‘density’ plot, or no plot (‘none’) on the color-key.
heatmap.2(as.matrix(a),scale="row",col=bluered(256),trace="none",labRow=NA,density.info="none",)
Comments
Post a Comment