如何在 Complexheatmap 包中进行颜色中断
How to make color break in Complexheatmap package
我正在尝试使用 complexheatmap 包创建热图。一切正常,除了我在整个情节中只能看到黑色。我认为适当的颜色中断应该可以解决问题,但我不知道如何解决这个问题:(
#load required libraries
library(extrafont)
#font_import() # only one time required when first time use the library extrafont
#y
fonts()
loadfonts()
library(ComplexHeatmap)
library(circlize)
#upload expression data
#heatdata<- read.table("probe.expression",header=TRUE,row.names=1)
dim(heatdata)
head(heatdata)
#scale row
rm <- rowMeans(heatdata)
sx <- apply(heatdata, 1, sd)
zz <- sweep(heatdata,1,rm)
zz <- sweep(zz, 1, sx, "/")
zzz <- t(scale(t(heatdata)))
Heatmap(zzz,
name = "Color key", # legend title
rect_gp = gpar(col = "black"), # cell border
column_title = "Tissue",
column_title_side = "top",
row_title = "Genes",
row_title_side = "left",
clustering_distance_rows = "pearson", #"euclidean", "maximum", "man-
#hattan", "canberra", "binary", "minkowski", #"pearson", #"spearman", "kendall"
row_dend_side = "left", #should the row cluster be put on the left or right of the heatmap?
#row_name_side = "right", #should the row cluster be put on the left or right of the heatmap?
show_row_names = FALSE,
column_dend_height = unit(3,"cm"),
show_column_dend = FALSE,
show_column_names= FALSE,
#bottom_annotation = ha,
#bottom_annotation_height = unit(1, "cm"),
col = colorRamp2(c(-2, 0,10),c("green","black", "red"))
)
和
min(zzz)
给出 -1.96339 而
max(zzz)
给了 9.238137。我的最终情节是这样的
可以查到测试数据HERE
我认为你应该删除 "rect_gp = gpar(col = "black")" 因为我猜你在矩阵中有很多行,如果设置了边框颜色,颜色将主要被单元格边框覆盖。
我正在尝试使用 complexheatmap 包创建热图。一切正常,除了我在整个情节中只能看到黑色。我认为适当的颜色中断应该可以解决问题,但我不知道如何解决这个问题:(
#load required libraries
library(extrafont)
#font_import() # only one time required when first time use the library extrafont
#y
fonts()
loadfonts()
library(ComplexHeatmap)
library(circlize)
#upload expression data
#heatdata<- read.table("probe.expression",header=TRUE,row.names=1)
dim(heatdata)
head(heatdata)
#scale row
rm <- rowMeans(heatdata)
sx <- apply(heatdata, 1, sd)
zz <- sweep(heatdata,1,rm)
zz <- sweep(zz, 1, sx, "/")
zzz <- t(scale(t(heatdata)))
Heatmap(zzz,
name = "Color key", # legend title
rect_gp = gpar(col = "black"), # cell border
column_title = "Tissue",
column_title_side = "top",
row_title = "Genes",
row_title_side = "left",
clustering_distance_rows = "pearson", #"euclidean", "maximum", "man-
#hattan", "canberra", "binary", "minkowski", #"pearson", #"spearman", "kendall"
row_dend_side = "left", #should the row cluster be put on the left or right of the heatmap?
#row_name_side = "right", #should the row cluster be put on the left or right of the heatmap?
show_row_names = FALSE,
column_dend_height = unit(3,"cm"),
show_column_dend = FALSE,
show_column_names= FALSE,
#bottom_annotation = ha,
#bottom_annotation_height = unit(1, "cm"),
col = colorRamp2(c(-2, 0,10),c("green","black", "red"))
)
和
min(zzz)
给出 -1.96339 而
max(zzz)
给了 9.238137。我的最终情节是这样的
可以查到测试数据HERE
我认为你应该删除 "rect_gp = gpar(col = "black")" 因为我猜你在矩阵中有很多行,如果设置了边框颜色,颜色将主要被单元格边框覆盖。