Column labels cropped when using pheatmap

后端 未结 3 1212
臣服心动
臣服心动 2020-12-19 14:39

I am plotting a heatmap using pheatmap (Documentation). I am plotting a matrix in a fairly straightforward way:

pheatmap(mat, a         


        
3条回答
  •  抹茶落季
    2020-12-19 15:06

    I figured this out, hopefully if anyone has this problem in the future it will help.

    This happens when you are using the labels_col= argument of pheatmap. In my scenario, which was a RNA-seq project using DESeq2, there was a targets file identifying the samples (columns), but for my column labels I was using a different column so the labels were more understandable, so I used

    labels_col=myThing$ThisOtherColumn
    

    The other column, while actually a string containing characters and numbers, for some reason was being read as an integer vector. So the solution was to do

    as.character(myThing$ThisOtherColumn)
    

    As long as you give labels_col a character vector it will adjust the columns automatically.

提交回复
热议问题