Repeater heat map .2 in R

I used the following code to create a heatmap using Heatmap.2 R. key = "F" gets rid of the color key at the top. However, the plot does not re-scale, leaving an empty space in the place previously occupied by the color key. How to return an object to the plot, getting rid of the empty space at the top?

dImp_heatmap <- heatmap.2(dSet_matrix, Rowv=NA, Colv=NA, col = cm.colors(20), dendrogram="none",trace="none", key="F",margins=c(1,8),colsep=c(1:6),rowsep=(1:62),sepwidth=c(0.05,0.05), sepcolor="white", cellnote=round(dSet_matrix,digits=2),notecol="black",notecex=0.7,scale="column") 
+4
source share
1 answer

If you carefully read the documentation for ?heatplot.2 , you will see the following at the bottom of the argument list:

lmat, lhei, lwid visual layout: position matrix, column height, column width. See below for more details.

And the details:

You can override this layout by specifying the appropriate values ​​for lmat, lwid, and lhei. lmat controls the relative sequence of each element, while lwid controls the width of the column, and lhei controls the height of the row. See the help page for the layout for details on how to use these arguments.

So for example:

 data(mtcars) x <- as.matrix(mtcars) rc <- rainbow(nrow(x), start=0, end=.3) cc <- rainbow(ncol(x), start=0, end=.3) ## ## demonstrate the effect of row and column dendrogram options ## gplots:::heatmap.2(x,key = FALSE,dendrogram = "row",lhei = c(0.05,0.95)) 

enter image description here

and I suppose the lwid setting will behave the same way. Although I must add that if you enable both dendrograms, the space in the upper left corner is necessary to make room for dendrograms.

+7
source

Source: https://habr.com/ru/post/1402311/


All Articles