[英]Reorder columns in heatmap, keep topology
I've generated the following heatmap in R 我在R中生成了以下热图
using the following code. 使用以下代码。
heatmap(data.matrix(data), col=colorRampPalette(c("yellow", "blue"))(64), labRow=NA, Rowv=NA)
I would like to plot the heatmap with a different column ordering. 我想以不同的列顺序绘制热图。 This column ordering maintains the topology of the dendrogram, so I would like to continue to plot the dendrogram as well. 此列顺序保持了树状图的拓扑,因此我也想继续绘制树状图。 The R help for the heatmap
function mentions row and column reordering, and I have tried providing the desired column order as a vector to heatmap
's Colv
argument, but this did not work. heatmap
功能的R帮助提到了行和列的重新排序,我尝试提供所需的列顺序作为heatmap
的Colv
参数的向量,但这是行不通的。 Any suggestions? 有什么建议么?
The arguments to Colv need to be an ordering passed to the reorder.dendrogram function. Colv的参数需要是传递给reorder.dendrogram函数的排序。 It will NOT produce an arbitrary ordering but will impose constraints by virtue of the column dendrogram structure. 它不会产生任意顺序,但会由于列树状图结构而施加约束。 This should produce a different ordering. 这将产生不同的顺序。
nc <- dim(data.matrix(data)}[2]
heatmap(data.matrix(data), Colv = sample(1:nc),
col=colorRampPalette(c("yellow", "blue"))(64),
labRow=NA, Rowv=NA)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.