plot(x) 在车辙 x <- hclust(y, "ave") 之后没有 return 图或任何输出或任何错误

plot(x) doesn't return a plot or any output or any error after rutting x <- hclust(y, "ave")

我正在尝试按照 PDF 中给出的说明构建共表达网络。第一步是构建树状图。这是代码。

link 到 LiverFemale3600.csv 在压缩文件中。

# Load the WGCNA package
library(WGCNA);

options(stringsAsFactors = FALSE);

#Read in the female liver data set
femData = read.csv("LiverFemale3600.csv");

datExpr0 = as.data.frame(t(femData[, -c(1:8)]));
names(datExpr0) = femData$substanceBXH;
rownames(datExpr0) = names(femData)[-c(1:8)];


sampleTree = hclust(dist(datExpr0), method = "average");

par(cex = 0.6);
par(mar = c(0,4,2,0))
plot(sampleTree, main = "Sample clustering to detect outliers", sub="", xlab="", cex.lab = 1.5, cex.axis = 1.5, cex.main = 2)

这里的 plot() 在 RStudio 中没有 return 任何东西。绘图 window 是空白的,但它也 return 没有任何错误。

当 show(sampleTree) 为 运行 时,我得到以下结果。

> show(sampleTree)

Call:
hclust(d = dist(datExpr0), method = "average")

Cluster method   : average 
Distance         : euclidean 
Number of objects: 135 

运行 如果您希望绘图出现在 RStudio 的绘图框中,只需 plot 行。否则 运行 par 行将打开一个单独的绘图 window,并且图形将不会出现在 RStudio 中的正常绘图框中。