0

I am trying to annotate data points in pheatmap. Everything works fine up until plotting the heatmap.

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)`    

For the last line, I get an error: Error in RColorBrewer::brewer.pal(n, pal) : NA is not a valid palette name for brewer.pal

I do not even use the RColorBrewer package nor specify any color. If I do use the RColorBrewer library and specify an annotation colour, I get the following error:

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

As for the independent column annotation, I have 3 clusters; each data point should belong to one.

IRTFM
  • 258,963
  • 21
  • 364
  • 487
A Z
  • 1
  • 1
  • 2
    Need data. Sounds like you have an intermediate reult that is NA and pheatmap is not dropping NA levels somewhere. "Where?" we might ask. But to answer we need to look at the process rather than guessing. – IRTFM May 29 '21 at 18:46
  • something wrong with your annotation data frame. see https://stackoverflow.com/questions/10300284/pheatmap-cluster-annotation – StupidWolf May 29 '21 at 19:02

0 Answers0