R-如何创建单列表热图 [英] R-how to create single column table heatmap

查看:70
本文介绍了R-如何创建单列表热图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可行的解决方案,但是可以.我一直在使用mtcars数据集,并尝试通过"disp"变量进行着色,作为我的可复制示例.

I have a working solution but am. I've been using the mtcars data set and trying to color by the "disp" variable as my reproducible example.

    > library(gplots)
    > m<-cbind(mtcars[,3],mtcars[,3])
    > rownames(m)<-rownames(mtcars)
    > heatmap.2(x=m,dendrogram="none",trace="none",Colv=FALSE,Rowv=FALSE,cellnote=cbind(rownames(m),rownames(m)),notecol="black")

我总是可以剪掉pdf的多余行,用实际数据集中的p值表示代替(绘图比率和p值是费舍尔与整个人口的确切差异),但是那会增加一个在500个值的整个表上进行大量处理(现在仅打印一个超长的pdf).我可以为p值列分别上色,然后将它们粘贴在一起形成最终图形,但假设这看起来很草率.随时都可以提出建议.

I can always cut out the extra row of the pdf, replace with a representation of the p-value in my actual data set (plotting ratios and p-value is fisher's exact difference from whole population), however that would add a large amount of processing on the full table of 500 values (right now just printing a giant length pdf). I may color the p-value column separately and paste them together for the final figure but assuming this will look sloppy. Suggestions at any step are appreciated.

推荐答案

使用ggplot2的解决方案:

A solution with ggplot2:

d=as.data.frame.table(m[,1,drop=FALSE])
ggplot(d,aes(x=Var2,y=Var1,fill=Freq)) + geom_tile()

这篇关于R-如何创建单列表热图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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