egeulgen / pathfindR

pathfindR: Enrichment Analysis Utilizing Active Subnetworks
https://egeulgen.github.io/pathfindR/
Other
182 stars 25 forks source link

Custom Colors for Graphics #34

Closed williamsdrake closed 4 years ago

williamsdrake commented 4 years ago

First, this package is fantastic! Thank you for your work thus far. I was wondering if there is a way to change the default colors for the bubble plots and term gene graphs. I was not able to find any arguments that change the colors in the pathfindR manual. Thanks for your help

egeulgen commented 4 years ago

thanks @williamsdrake! glad you like pathfindR.

There are no arguments for customizing colors for enrichment_chart() and term_gene_graph(). However, both of these return ggplot objects so you can replace the color scale via:

g <- enrichment_chart(RA_output)
g <- g + scale_color_gradient(low = "gray60", high = "green")
g

and for term_gene_graph() (it's a bit trickier (because you also need to supply the labels):

g <- term_gene_graph(RA_output)
g <- g + scale_colour_manual(values = c("orange", "purple", "blue"),
                        labels = c("enriched term",
                                   "up-regulated gene",
                                   "down-regulated gene"))
g

Hope this helps, Best, -E

williamsdrake commented 4 years ago

Thank you very much, this clears it up!