YuLab-SMU / enrichplot

Visualization of Functional Enrichment Result
https://yulab-smu.top/biomedical-knowledge-mining-book/
226 stars 65 forks source link

how can i change the colour of category node of my own choice in cnetplot #282

Open Sidragull57 opened 2 months ago

guidohooiveld commented 1 month ago

Use the argument category (to change it from its default value #E5C494).


> ## load required libaries
> library(clusterProfiler)
> library(enrichplot)
> library(org.Hs.eg.db)
> 
> ## using the example dataset.
> data(geneList, package="DOSE")
> genes <- names(geneList)[abs(geneList) > 2]
> 
> ego <- enrichGO(gene          = genes,
+                 universe      = names(geneList),
+                 OrgDb         = org.Hs.eg.db,
+                 ont           = "ALL",
+                 pAdjustMethod = "BH",
+                 pvalueCutoff  = 0.01,
+                 qvalueCutoff  = 0.05,
+                 readable      = TRUE)
> 
> ## prepare cnetplot, but color gene sets green, 
> ## and genes by log2FC.
> color.params = list(category = "green", foldChange = geneList)
> p1 <- cnetplot(ego, color.params=color.params)
> print(p1)
>

image