Entering edit mode
5 months ago
Gerard
▴
10
Hello,
I ran a enrichment analysis using clusterprofiler, like this :
upregulated_enrich <- enrichGO(
gene = rownames(upregulated_genes),
OrgDb = org.Hs.eg.db,
keyType = "SYMBOL",
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff = 0.05,
qvalueCutoff = 0.05
)
Then I made a bar plot out of the result:
barplot(upregulated_enrich, x = "Count", color = "p.adjust", showCategory = 15, font.size = 10, cex.names = 1.5)
The problem is, the color is a gradient going from red to blue, and I would like it to be in grey.
I tried several things, as I understood barplot made a ggplot object I tried to add scale_color_gradient but it doesn't work. I also tried to add the argument col = c("black", "grey")
to the barplot function but it does not change the color.
Can anybody help ? Thank you in advance
As an update, I tried to do the plot directly through ggplot, like this :
But I get the following error :
I'm trying to color the bars of the plot according to the adjusted p-value, but it's a continuous coloring and not a discrete one, any way to fix this ?
Many thanks