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

R编程-在EMA包中使用clustering.plot时图形边缘过大错误,r,plot,R,Plot,我是一名R编程初学者,我正在尝试实现R包EMA中可用的clustering.plot方法。我的聚类工作得很好,我也可以看到填充的结果。但是,当我尝试使用clustering.plot生成热图时,它会给我一个错误“error in plot.new():graphic edges too large”。下面是我的代码 #Loading library library(EMA) library(colonCA) #Some information about the data data(colon

我是一名R编程初学者,我正在尝试实现R包EMA中可用的clustering.plot方法。我的聚类工作得很好,我也可以看到填充的结果。但是,当我尝试使用clustering.plot生成热图时,它会给我一个错误“error in plot.new():graphic edges too large”。下面是我的代码

#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)
#加载库
图书馆(EMA)
图书馆(科隆加)
#关于数据的一些信息
数据(科隆卡)
摘要(科隆卡)
类(colonCA)#表达式集
#从colonCA中提取表达式矩阵

expr\u mat在您的示例中,expr\u mat的一些行名非常长(
max(nchar(rownames(expr\u mat))
=271个字符)。
clustering\u plot
函数尝试为所有名称留出足够大的边距,但由于名称太长,没有空间容纳任何其他名称

真正长的名字中似乎有很长的句点。浓缩这些基因名字的一种方法是用一个句点代替两个或更多的句点,所以我在这一行加上

#Extract expression matrix from colonCA
expr_mat <- exprs(colonCA)
rownames(expr_mat)<-gsub("\\.{2,}","\\.", rownames(expr_mat))
#从colonCA中提取表达式矩阵

expr\u mat增加绘图区域的大小并重新运行代码。我刚刚用20 x 20英寸的PDF尝试了这一点,但仍然抛出了错误消息(尽管
clustering.plot(tree=expr\u sample,title=“heatmap of clustering”,trim.heatmap=1)
确实有效).是的,还没有找到解决问题的方法!!!非常感谢!这解决了我的问题,并有可能让我知道在拍摄情节时会出现什么问题:)