RColorBrewer::brewer.pal(n, pal) 中的错误:NA 不是 brewer.pal 的有效调色板名称

问题描述

我正在尝试在 pheatmap 中注释数据点。在绘制热图之前,一切正常。

data <- as.matrix(Round_1)                                                            
library(pheatmap)                                                                       
df = data.frame(Annotation)                                                               
colnames(df) = colnames(data)                                                             
pheatmap(data,cluster_rows = FALSE,cellwidth = 10,cellheight = 12,annotation_col = df)`    

最后一行出现错误Error in RColorBrewer::brewer.pal(n,pal) : NA is not a valid palette name for brewer.pal

我什至不使用 RColorBrewer 包,也不指定任何颜色。如果我确实使用了 RColorBrewer 库并指定了注释颜色,则会出现以下错误

    Error in annotation_colors[[names(annotation)[i]]] <- brewer_pal("seq",: 
  more elements supplied than there are to replace

至于独立列注解,我有3个簇;每个数据点都应该属于一个

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)