0

为了制作流式细胞术实验的散点图,我在过去几周使用了以下代码。在运行代码时,我没有收到大量错误(从数据集中删除了 10,000 个条目中的 20 个)。

visual <- ggplot(data=dots, aes(GRNHLin, REDHLin)) +
    geom_point(colour=rgb(0.17, 0.44, 0.71), size=0.500, alpha=0.250) +
    #stat_density_2d(aes(alpha = ..density..), geom = 'tile', contour = FALSE) +
    geom_tile(aes(width = 0.004)) +
    scale_x_log10(breaks = trans_breaks("log10", function(x) 10^x),
                  labels = trans_format("log10", math_format(10^.x)), limits = c(1,1e4)) +
    scale_y_log10(breaks = trans_breaks("log10", function(x) 10^x),
                  labels = trans_format("log10", math_format(10^.x)), limits = c(1,1e3)) +
    geom_vline(xintercept=threshold_green) +
    labs(x="Green Fluorescence Intensity", y="Red Fluorescence Intensity", size=18)
visual

现在我想使用 Mclust 包中的基于模型的聚类,我使用 fviz_cluster 作为函数来创建散点图。只有这一次,我在运行下面的代码后收到以下错误。

警告消息: 1:在 self$trans$transform(x) 中:产生了 NaN 2:转换在连续 x 轴中引入了无限值 3:在 self$trans$transform(x) 中:产生了 NaN 4:转换在连续中引入了无限值y 轴 5:删除了 9110 行包含缺失值 (geom_point)。

dots <- read_csv(file_of_sample)
names(dots) <- str_replace_all(names(dots), c("-" = ""))
  
dots <- dots %>%
  select("GRNHLin", "RED2HLin")
    
dots <- dots %>%
  filter(RED2HLin >= 1.0)

dots.Mclust <- Mclust(dots, modelNames="VVV", G=8)
#BIC <- mclustBIC(logdots)
#ICL <- mclustICL(logdots)
#summary(BIC)
#summary(ICL)

visual <- fviz_cluster(dots.Mclust, 
             ellipse=FALSE, 
             shape=20, 
             ellipse.alpha = 0.1,
             alpha=0.450, 
             geom = c("point"),
             show.clust.cent = FALSE,
             main = FALSE,
             legend = c("right"),
             palette = "npg",
             legend.title = "Clusters"
             ) +
  labs(x="Green Fluorescence Intensity", y="Red Fluorescence Intensity") +
  scale_x_log10(breaks = trans_breaks("log10", function(x) 10^x),
                labels = trans_format("log10", math_format(10^.x)), limits = c(1,1e4)) +
  scale_y_log10(breaks = trans_breaks("log10", function(x) 10^x),
                labels = trans_format("log10", math_format(10^.x)), limits = c(1,1e3))

visual

谁能帮我解决这个问题?

4

0 回答 0