首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >R编程-在EMA包中使用clustering.plot时图形边误差过大

R编程-在EMA包中使用clustering.plot时图形边误差过大
EN

Stack Overflow用户
提问于 2014-06-04 08:25:53
回答 1查看 136关注 0票数 1

我是一个R编程初学者,我正在尝试实现R中可用的clustering.plot方法。我的集群工作得很好,我也可以看到填充的结果。然而,当我试图使用clustering.plot生成一个热图时,它会给我一个错误“plot.new ()中的错误:图形边缘太大”。我下面的代码,

代码语言:javascript
复制
#Loading library
library(EMA)
library(colonCA)

#Some information about the data
data(colonCA)
summary(colonCA)
class(colonCA) #Expression set

#Extract expression matrix from colonCA
expr_mat <- exprs(colonCA)

#Applying average linkage clustering on colonCA data using Pearson correlation
expr_genes <- genes.selection(expr_mat, thres.num=100)
expr_sample <- clustering(expr_mat[expr_genes,],metric = "pearson",method = "average")
expr_gene <- clustering(data = t(expr_mat[expr_genes,]),metric = "pearson",method =   "average")
expr_clust <- clustering.plot(tree = expr_sample,tree.sup=expr_gene,data=expr_mat[expr_genes,],title = "Heat map of clustering",trim.heatmap =1)

在实际执行集群过程时,我不会遇到任何错误。有人能帮忙吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-06-04 19:12:29

在您的示例中,expr_mat的一些行名非常长(max(nchar(rownames(expr_mat)) =271个字符)。clustering_plot函数试图为所有名称提供足够大的页边距,但是由于名称太长,所以没有空间容纳任何其他名称。

真正长的名字似乎有很长的一段时间。压缩这些基因的名称的一种方法是将两个或更多个周期的运行替换为一个,所以我将在这一行中添加

代码语言:javascript
复制
#Extract expression matrix from colonCA
expr_mat <- exprs(colonCA)
rownames(expr_mat)<-gsub("\\.{2,}","\\.", rownames(expr_mat))

然后,您可以运行所有其他命令,并按正常方式绘制。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24032460

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档