使用 pheatmap 为热图制作连续颜色图表
我正在研究如何使用 pheatmap 包并制作连续的颜色编码热图。
我想为我的地图使用红、白、蓝三种颜色,其中白色 = 0,蓝色代表负数,红色代表正数。我希望它是连续的,而不是任何 0 = 白色,正值是红色,但更多的是从纯红色到浅色的过渡,直到白色。
我在文档中找不到它,所以也许是我对如何使其工作缺乏了解。
这是我目前的代码。
pheatmap(heatmap_matrix,
cluster_rows = T,
cluster_cols = T,
color = c("blue", "white", "red"),
angle_col = 90)
谢谢你!
I'm looking to figure out how to use the pheatmap package and to make a continuous color coded heatmap.
I would like to use three colors, red, white and blue to for my map, where white = 0, blue is for negative numbers, and red for positive. I want it such that it would be continuous, rather than anything being 0 = white, and positive being red, but more of a transition from a solid red to lighter fades until white.
I couldnt find it in the documentation, so perhaps it is my lack of understanding on how to get it to work.
Here is my code currently.
pheatmap(heatmap_matrix,
cluster_rows = T,
cluster_cols = T,
color = c("blue", "white", "red"),
angle_col = 90)
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
colorRampPalette
提供一个长的过渡颜色向量:You could just supply a long vector of transitioning colours using
colorRampPalette
: