Entering edit mode
5.5 years ago
saamar.rajput
▴
80
I am trying to make a bar plot, the length of which is the percentage of genes in a GO term and I would like to color the bars corresponding to the range of their p-values.
My data looks like this:
head(Up_Down)
GO Percentage q.val
1 extracellular region part 2.7028565 2.305075e-07
2 extracellular space 2.1167634 2.305075e-07
3 cytokine activity 0.5917833 1.498300e-06
4 inflammatory response 1.3599636 0.7
coloursv <- Up_Down$q.val
names(coloursv) <- Up_Down$q.val
ggplot(data=Up_Down, aes(x=GO, y=Percentage)) +
geom_bar(stat="identity") +
scale_fill_manual(coloursv,guide = F)+
theme(axis.text.x = element_text(angle =90, hjust = 1,vjust=0.5))
The plot is generated successfully the way I want but unfortunately the bars are not coloured according to the q.val. Can somebody help me identify what is going wrong.
Why not just: