Error in plot.window(…) : need finite 'xlim

2019-09-10 09:29发布

I'm able to plot a dendrogram with hclust class, but when I'm trying to convert it to as.phylo in ape package it gives me the error for the plot

Error in plot.window(...) : need finite 'xlim' values

Any idea what can cause the problem?

Thanks,

mymerge<-Merg_Mat
myheight<-cumsum(abs(diff(ll)))
myhclust=list(order=lab,merge=mymerge,height=myheight)
class(myhclust)="hclust"
plot(as.phylo(myhclust),edge.col=colors,edge.width = 2, edge.lty =1,font=1)

标签: r
1条回答
smile是对你的礼貌
2楼-- · 2019-09-10 10:10

My guess would be that the figure is too big for your window, try to output it into a file.

pdf("my_plot.pdf")
plot(as.phylo(myhclust),edge.col=colors,edge.width = 2, edge.lty =1,font=1)
dev.off()

If you read the plot.phylo function code, you'll see that xlim is set to c(0, depth_of_your_tree). So if it is too big for the device (window or postscript, see here, it simply is because your tree is too deep.

PDF maximum page size is so big it should be able to hold your figure.

查看更多
登录 后发表回答