显示包含值的矩阵作为热图 [英] display a matrix, including the values, as a heatmap

查看:69
本文介绍了显示包含值的矩阵作为热图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做的就是获取这个矩阵:

What I'd like to do is take this matrix:

> partb
                0.5  1.5   1a   1b   -2   -3
A1FCLYRBAB430F 0.26 0.00 0.74 0.00 0.00 0.00
A1SO604B523Q68 0.67 0.33 0.00 0.00 0.00 0.00
A386SQL39RBV7G 0.00 0.33 0.33 0.33 0.00 0.00
A3GTXOXRSE74WD 0.41 0.00 0.08 0.03 0.05 0.44
A3OOD9IMOHPPFQ 0.00 0.00 0.33 0.00 0.33 0.33
A8AZ39QM2A9SO  0.13 0.54 0.18 0.13 0.00 0.03

然后创建一个热图,其中包含现在彩色单元格中的每个值.

And then make a heatmap that has each of the values in the now colored cells.

制作热图很容易:

> heatmap( partb, Rowv=NA, Colv=NA, col = heat.colors(256),  margins=c(5,10))

但是对于我的一生,我无法弄清楚如何将值放在每个单元格中.

But for the life of me I can't figure out how to put the value in each of the cells.

我想念什么?当然,这是很平常的事情.

What am I missing? Surely this is a common thing.

推荐答案

尝试heatmap.2 rel ="noreferrer"> gplots 软件包. cellnote和notecol参数控制放置在单元格中的文本.您可能还需要dendrogram = "none".

Try heatmap.2 from the gplots package. The cellnote and notecol parameters control the text placed in cells. You'll probably want dendrogram = "none" as well.

这篇关于显示包含值的矩阵作为热图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆