Reputation: 305
I am trying to creat a heatmap using complexheatmap package. Everything is working except that I can see only black color throughout the plot. I think proper colour break should do the trick but I don't know how to fix this :(
#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"))
)
and
min(zzz)
gave -1.96339 while
max(zzz)
gave 9.238137. My final plot look like this
test data can be found HERE
Upvotes: 0
Views: 1783
Reputation: 1321
I think you should remove "rect_gp = gpar(col = "black")" because I guess you have many rows in matrix that the color will be mainly covered by the cell borders if the border color is set.
Upvotes: 1