'gpar' element 'fill' must not be length 0
1
0
Entering edit mode
21 months ago
sansan96 ▴ 130

Hello everyone,

I'm trying to make a heatmap but I get the following error, can you help me?

topVarGenes <- head(order(rowVars(assay(rld)), decreasing = TRUE), 20)

mat <- assay(rld)[ topVarGenes, ]

mat <- mat - rowMeans(mat)

anno <- as.data.frame(colData(rld)[, c("Condition")])

pheatmap(mat, annotation_col = anno)

Error in check.length("fill") : 'gpar' element 'fill' must not be length 0

element pheatmap gpar • 1.9k views
ADD COMMENT
1
Entering edit mode
21 months ago
Basti ★ 2.0k

It is a problem of annotation formatting, which should be a data.frame with the same rownames as your data colnames.

library(dplyr)
anno = colData(rld) %>% as.data.frame() %>% select(condition)
pheatmap(mat, annotation_col = anno)
ADD COMMENT
0
Entering edit mode

Thanks so much, it worked for me.

ADD REPLY

Login before adding your answer.

Traffic: 2367 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6