我是一个R编程初学者,我正在尝试实现R中可用的clustering.plot方法。我的集群工作得很好,我也可以看到填充的结果。然而,当我试图使用clustering.plot生成一个热图时,它会给我一个错误“plot.new ()中的错误:图形边缘太大”。我下面的代码,
#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)在实际执行集群过程时,我不会遇到任何错误。有人能帮忙吗?
发布于 2014-06-04 19:12:29
在您的示例中,expr_mat的一些行名非常长(max(nchar(rownames(expr_mat)) =271个字符)。clustering_plot函数试图为所有名称提供足够大的页边距,但是由于名称太长,所以没有空间容纳任何其他名称。
真正长的名字似乎有很长的一段时间。压缩这些基因的名称的一种方法是将两个或更多个周期的运行替换为一个,所以我将在这一行中添加
#Extract expression matrix from colonCA
expr_mat <- exprs(colonCA)
rownames(expr_mat)<-gsub("\\.{2,}","\\.", rownames(expr_mat))然后,您可以运行所有其他命令,并按正常方式绘制。

https://stackoverflow.com/questions/24032460
复制相似问题