【发布时间】:2020-05-26 00:16:13
【问题描述】:
我正在使用包heatmaply 来可视化单细胞表达数据。
我想使用自定义颜色并将“黄色”分配给表达式级别> 2,将“洋红色”分配给表达式级别[-2,2] 之间的范围应该用“洋红色”-“黑色”-“黄色”的平滑渐变来表示。
在这里,我的示例文件是一个 10 行 x 5 列的矩阵:
my_palette<-PurpleAndYellow(50)
heatmaply(test,col = my_palette, dendrogram = "none")
它会生成正确的“PurpleAndYellow”颜色热图,但它会在整个范围内缩放 [-5, +5]
如果我指定scale_fill_gradient_fun,则热图的颜色变为“RdBu”幽灵(Heatmap2):
heatmaply(ab, col = my_palette, dendroram="none",
scale_fill_gradient_fun = ggplot2::scale_fill_gradient2(
low = "magenta", mid="black",high = "yellow", midpoint = 0,
limits = c(-2, 2)))
您能告诉我如何使用 heatmaply 更改颜色和调整热图的亮度吗?
【问题讨论】: