使用Pheatmap时裁剪的列标签 [英] Column labels cropped when using pheatmap

查看:179
本文介绍了使用Pheatmap时裁剪的列标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 pheatmap (

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

pheatmap(mat, annotation_col=df, labels_col=rld$Infection_Line, fontsize_row=5, fontsize_col=7) 

我的图的底部被截断了,所以我看不到底部的列名.看起来像这样:

The bottom of my plot is getting cut off so that I can't see the column names at the bottom. It looks like this:

请注意,这不是热点图.

我在此问题,以及我可以通过google和此功能的文档中找到的其他内容.

I have tried the solutions at this question and at this question, as well as other things I've been able to find through google and in the documentation for this function.

我尝试使用par()和oma()以及cexRow增加边距.

I have tried to increase the margins using par() and oma(), as well as cexRow.

margins=(x,y); par(mar=c(1,2,3,4)); par(oma=c(1,2,3,4))  

对情节没有影响.

我需要这样做,以便我可以看到这些长列名而不会减小我的绘图大小.我只想将底部的边距拉长.

I need to make it so that I can see these long column names without reducing my plot size. I just want to stretch the margin at the bottom down.

推荐答案

我想出了这一点,希望以后有人遇到此问题会有所帮助.

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

使用pheatmap的labels_col =参数时会发生这种情况.在我的场景中(这是一个使用DESeq2的RNA-seq项目),有一个目标文件可以识别样品(列),但是对于我的列标签,我使用了不同的列,因此标签更易于理解,因此我使用了

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)

只要您给labels_col一个字符向量,它将自动调整列.

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

这篇关于使用Pheatmap时裁剪的列标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆