2016-08-11 41 views
0

我正在嘗試使用complexheatmap包創建一個heatmap。除了我在整個劇情中只能看到黑色外,一切都在起作用。我認爲正確的色彩分離應該做的伎倆,但我不知道如何解決這個問題:(如何使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我的最終情節看起來像這樣

enter image description here

測試數據可以發現HERE

回答

1

我想你應該刪除「rect_gp = gpar(COL =‘黑’),」因爲我想你在基質許多行的顏色將是如果邊框顏色設置,主要由單元格邊框覆蓋。

+0

嗨顧,謝謝你解決我的問題。我想使用複雜的熱圖生成一個像https://openi.nlm.nih.gov/imgs/512/210/3118787/PMC3118787_1471-2164-12-252-4.png這樣的圖像。你能提出一些我應該使用的參數嗎? – pali

相關問題