R:为什么Heatmap在具有相同编号的行中显示白色? [英] R: Why Heatmap shows white color for rows with equal number?

查看:248
本文介绍了R:为什么Heatmap在具有相同编号的行中显示白色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是3个列和5行的矩阵.当我创建热图时,任何具有相似数字的行(如下面的示例(0.3、0.3、0.3))都会在热图中显示白色.我的目的是将其更改为任何所需的颜色. 示例:这是一个示例:

in the following example, a matrix of 3 cols and 5 rows. when I create a heatmap, any row that has similar numbers like the example below (0.3,0.3,0.3) it shows white color in the heatmap. and my intention is to change it to any desirable color. Example: here is an example:

    A = matrix(c(0.0183207, 0.0000000, 0.1468750, 0.03, 0.03, 0.03,0.4544720,0.0000000,0.1395850,0.002,0,0,1.1,1,1),nrow=5,ncol=3,byrow = TRUE) 
dimnames(A) = list(c("row1", "row2","row3","row4","row5"),c("col1", "col2", "col3"))
heatmap.2( A,col =redgreen, scale = "row", cexRow=0.3, cexCol=0.8, margins=c(6,6), trace="none")

非常感谢您的帮助

推荐答案

颜色为白色,因为您的heatmap命令会在绘制热图之前缩放行.因此,在这种颜色方案中,行c(0.3,0.3,0.3)变为零行,零用白色表示.

The color is white because your heatmap command scales the rows before drawing the heatmap. So the row c(0.3, 0.3, 0.3) becomes a row of zeroes and zero is denoted by white in this color scheme.

如果您要为这些行使用其他颜色方案,则必须考虑是否确实要缩放行,或者使用breakscol参数为值0创建单独的颜色.

If you want some other color scheme for these rows you must either think if you really want to scale the rows or play with the breaks and col arguments to create separate color for value 0.

这篇关于R:为什么Heatmap在具有相同编号的行中显示白色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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