如何使用大矩阵制作热图? [英] How can I make a heatmap with a large matrix?

查看:284
本文介绍了如何使用大矩阵制作热图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个1000 * 1000的矩阵(仅包含整数0和1),但是当我尝试制作热图时,会发生错误,因为它太大了.

I have a 1000*1000 matrix (which only includes integer 0 and 1), but when I tried to make a heatmap, an error occurs because it is too large.

如何使用如此大的矩阵创建热图?

How can I create a heatmap with such a large matrix?

推荐答案

我可以相信,热图至少需要花费很长时间,因为heatmap做了很多花哨的东西,这需要额外的时间和内存.使用@ bill_080的示例中的dat:

I can believe that the heatmap is, at least, taking a long time, because heatmap does a lot of fancy stuff that takes extra time and memory. Using dat from @bill_080's example:

## basic command: 66 seconds
t0 <- system.time(heatmap(dat))
## don't reorder rows & columns: 43 seconds
t1 <- system.time(heatmap(dat,Rowv=NA))
## remove most fancy stuff (from ?heatmap): 14 seconds
t2 <- system.time( heatmap(dat, Rowv = NA, Colv = NA, scale="column",
             main = "heatmap(*, NA, NA) ~= image(t(x))"))
## image only: 13 seconds
t3  <- system.time(image(dat))
## image using raster capability in R 2.13.0: 1.2 seconds
t4 <- system.time(image(dat,useRaster=TRUE))

您可能要考虑热图中真正想要的东西-即,您是否需要精美的树状图/重新排序的东西?

You might want to consider what you really want out of the heatmap -- i.e., do you need the fancy dendrogram/reordering stuff?

这篇关于如何使用大矩阵制作热图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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