You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求推荐R语言中替代clusterProfiler包dotplot的绘图工具

Hey there! I totally get your frustration with clusterProfiler's dotplot not playing nice with your own data—those auto-generated object quirks can be such a headache. Let me walk you through some reliable alternatives that deliver exactly the dotplot functionality you're looking for:

Top Alternatives for Reproducible Functional Enrichment Dotplots

1. ggplot2 (Full Customization Control)

This is my go-to for cases where I need full say over every element of the plot. All you need is a tidy dataframe with these columns:

  • Cluster names (for the X-axis)
  • Biological process terms (for the Y-axis)
  • Fold change (or your "importance" metric for point color)
  • A metric for point size (like number of genes in the term, or enrichment score)

Since you only want to show terms that exist in specific clusters, just filter your dataframe to keep only those valid cluster-term pairs—ggplot will automatically omit any missing combinations. Here's a quick example:

library(ggplot2)

# Example dataframe structure
enrich_data <- data.frame(
  cluster = c("Cluster 1", "Cluster 1", "Cluster 2", "Cluster 3"),
  biological_process = c("Cell proliferation", "Apoptosis", "Cell proliferation", "DNA repair"),
  fold_change = c(2.8, 1.5, 3.2, 2.1),
  gene_count = c(12, 8, 15, 9)
)

# Build the plot
ggplot(enrich_data, aes(x = cluster, y = biological_process)) +
  geom_point(aes(color = fold_change, size = gene_count)) +
  scale_color_gradient(low = "#3366CC", high = "#FF3333") + # Custom color scale
  theme_bw() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) # Rotate X-axis labels for readability

The best part? No weird auto-generated objects to deal with—you're in full control of the data input.

2. ggpubr::ggdotplot (Simplified, Quick-to-Use)

If you want the power of ggplot without writing all the boilerplate code, ggpubr's ggdotplot is perfect. It wraps ggplot2 into a more user-friendly interface while still supporting all the mappings you need:

library(ggpubr)

ggdotplot(enrich_data, 
          x = "cluster", 
          y = "biological_process",
          color = "fold_change", 
          size = "gene_count",
          palette = "RdBu", # Pre-built color palette
          rotate.x.text = TRUE)

This is great for rapid iteration when you need a polished plot fast.

3. enrichplot::dotplot (ClusterProfiler Ecosystem Companion)

If you're still working within the clusterProfiler ecosystem but want to avoid the auto-generated object issues, enrichplot's dotplot function can accept manually curated dataframes (not just enrichResult objects). Just structure your data to include columns like Description (biological process), Cluster, fold_change (or your importance metric), and Count (gene number), then pass it to the function. It’s a good middle ground if you want to stick with tools you’re familiar with.

All these options let you:

  • Display only the biological process-cluster pairs that exist in your data
  • Map point color to your importance metric (fold change)
  • Map point size to any other relevant metric (gene count, enrichment score, etc.)

内容的提问来源于stack exchange,提问作者mightaskalot

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 08:53:16