具有用户定义的颜色条的关系矩阵的热图
Heatmap for a relationship matrix with user-defined colorbar
我想绘制一个相互关系矩阵的热图来显示与 1
的距离。
我制作了如下热图,但我想根据与 1
的 距离定义 colour
;数字越远颜色越浅
library(pheatmap)
pheatmap(Interrelation, cluster_rows = FALSE, cluster_cols = FALSE)
这是一个颜色范围从 "darkblue"
到 "lightblue"
的示例,较深的颜色分配给 mtcars
数据集的中值。
library(pheatmap)
#you can decrease 0.5 if you want finer palette
my_colors <- seq(min(mtcars),max(mtcars), by=0.5)
my_palette <- c(colorRampPalette(colors=c("lightblue","darkblue"))(n=(length(my_colors)-1)/2),
"darkblue",
colorRampPalette(colors=c("darkblue","lightblue"))(n=(length(my_colors)-1)/2))
pheatmap(mtcars,
scale = "none",
cluster_cols=FALSE,
cluster_rows = FALSE,
treeheight_row=0,
show_rownames=FALSE,
main = "Example",
color = my_palette,
breaks = my_colors)
我想绘制一个相互关系矩阵的热图来显示与 1
的距离。
我制作了如下热图,但我想根据与 1
的 距离定义 colour
;数字越远颜色越浅
library(pheatmap)
pheatmap(Interrelation, cluster_rows = FALSE, cluster_cols = FALSE)
这是一个颜色范围从 "darkblue"
到 "lightblue"
的示例,较深的颜色分配给 mtcars
数据集的中值。
library(pheatmap)
#you can decrease 0.5 if you want finer palette
my_colors <- seq(min(mtcars),max(mtcars), by=0.5)
my_palette <- c(colorRampPalette(colors=c("lightblue","darkblue"))(n=(length(my_colors)-1)/2),
"darkblue",
colorRampPalette(colors=c("darkblue","lightblue"))(n=(length(my_colors)-1)/2))
pheatmap(mtcars,
scale = "none",
cluster_cols=FALSE,
cluster_rows = FALSE,
treeheight_row=0,
show_rownames=FALSE,
main = "Example",
color = my_palette,
breaks = my_colors)