二进制R热图仍显示渐变 [英] Binary R heatmap still displays gradient

查看:187
本文介绍了二进制R热图仍显示渐变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为R中的二进制数据(11 x〜1500)矩阵绘制热图.

I'm trying to plot a heatmap for a matrix of binary data (11 x ~1500) in R.

heatmap(y, col = hmcols);

矩阵"y"看起来像这样

the matrix 'y' looks like this

[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,]    0    0    0    0    1    1    1    1    1     1     1     1     1
[2,]    0    0    1    0    0    1    0    0    0     0     0     0     1
[3,]    0    0    0    0    0    1    1    1    1     0     0     1     1 ...etc...

我正在使用默认的距离和聚类功能,但是由于某种原因,我的热图显示了颜色渐变.我也尝试使用二进制距离函数,尽管发生了类似的梯度变化.是否由于每个样本之间的距离而在样本中缺乏相似性?这是热图的图像:

I'm using the default distance and clustering functions, but for some reason my heatmap displays a gradient of color. I've tried to use the binary distance function as well, although a similar gradied occurs. Is this a lack of similarity in samples due to the distance between each sample? Here is an image of the heatmap:

https://www.dropbox.com/s/jz1r41lhnrkisvz/Rplots.pdf

我之所以这样,是因为我对默认距离和聚类函数如何对数据重新排序一无所知.如何解释这些结果?

I feel like this is due to my lack of understanding of exactly how the default distance and clustering functions reorder data. How can I interpret these results?

推荐答案

正如@Joran指出的那样,scale参数是可以使用的参数:

As @Joran point out, the scale argument is the one to go with:

(注意:由于您没有提供完整的数据集,因此降低了维数并生成了随机数据)

(Note: I reduced dimensionality and generated random data since you did not provide your full set)

颜色由col选择,如果您想要简单的黑白,可以进行col = c("black", "white"),但也可以使事情变得更有趣:

The colors are chosen by col, if you want simple black and white you can do col = c("black", "white"), but you can also make things more interesting:

x <- matrix(sample(c(0, 1), 15*15, replace = TRUE), nrow = 15)
heatmap(x, scale = "none", Rowv = NA, Colv = NA, col = cm.colors(2), main = "HeatMap Example") 

这篇关于二进制R热图仍显示渐变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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