R Heatmaply和Pheatmap输出 [英] R heatmaply and pheatmap output
本文介绍了R Heatmaply和Pheatmap输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用R heatmaply
包来生成交互式热图.我喜欢该软件,但我想从中获得与使用pheatmap
包时相同的颜色输出.因此,我希望这两个命令产生相同的输出:
I am using the R heatmaply
package to produce interactive heatmaps. I like the software, but I would like to get from it the same color output I get using the pheatmap
package. Therefore, I would like the two commands to produce the same ouput:
heatmaply (scale (mtcars))
pheatmap (scale (mtcars))
有没有办法做到这一点? 提前致谢. 阿图罗
Is there a way to do this? Thanks in advance. Arturo
推荐答案
您可以使用formals()
获取默认的颜色参数pheatmap()
.
You can use formals()
to get the default color argument of pheatmap()
.
formals(pheatmap)$color
# colorRampPalette(rev(brewer.pal(n = 7, name = "RdYlBu")))(100)
然后将heatmaply()
的color参数设置为相同的参数:
Then set the color argument of heatmaply()
to the same one:
col <- colorRampPalette(rev(RColorBrewer::brewer.pal(n = 7, name = "RdYlBu")))(100)
heatmaply(scale(mtcars), colors = col, grid_color = "grey60")
- 颜色功能
brewer.pal()
来自RColorBrewer
软件包,因此您需要预先安装并加载::
或library()
. -
grid_color
对应于pheatmap()
中的border_color
. - The color function
brewer.pal()
is from theRColorBrewer
package, so you need to install and load it with::
orlibrary()
in advance. grid_color
inheatmaply()
is corresponding toborder_color
inpheatmap()
.
heatmaply()
中的
这篇关于R Heatmaply和Pheatmap输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文