Deleted:How to change pathway color nodes in cnetplot?
0
0
Entering edit mode
DN1 • 0
@a21ee43e
Last seen 3.7 years ago
United Kingdom

I have a pathway plot using cnetplot() in R from the enrichplot package. I am able to change individual gene nodes' colors no problem, but I want to change the beige pathway nodes colors and I can't figure out how.

I've tried different attempts from a github thread asking the same question, but none of the answers work (https://github.com/YuLab-SMU/enrichplot/issues/66)

My code for the plot is this:

p = cnetplot(top5all, showCategory = 5,
             categorySize ='pvalue',
             foldChange = gene_list_scores)
m = match(p$data$name ,cat_table$entrez_gene_symbol)
Druggability = cat_table$Druggability[m]


p + geom_node_point(aes(shape=Druggability))+ 
  scale_color_gradient2(name='Score', midpoint = 0.85,  high='Red', mid='purple', low='blue') +
  scale_size_continuous(range = c(2, 10)) +  
  scale_shape_manual(values=seq(0,16)) +
  labs(title = paste("Significant Pathways"))

The plot output essentially looks like any cnetplot with beige pathway nodes - how can I change the color of these nodes in particular?

I've tried running this code but it doesn't work:

cnetplot[["layers"]][[2]][["mapping"]][["colour_new"]][[2]][[2]] <- "black"
Error in `*tmp*`[["layers"]] : 
  object of type 'closure' is not subsettable

And I've tried adding color_category = "#000000" inside cnetplot() which also doesn't work. The package's supplementary material has an example using this to change the pathway node colors, but it seems to only work if you don't want to change any gene node colours.

An example plot looks like this (and it's only the beige nodes that I want to color change):

enter image description here

cnetplot r enrichment • 1.8k views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 776 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6