I am plotting columns gene and logFC of following data frame using ggplot: I have omitted some lines for simplicity
gene variable logFC logP
CS, gltA 25:1 vs 5:1 -1.6443477 11.3492020
ACO, acnA 25:1 vs 5:1 -1.4393181 8.1938808
IDH3 25:1 vs 5:1 -1.6374355 5.0329107
LSC1 25:1 vs 5:1 0.6577531 0.5235756
CS, gltA 250:1 vs 5:1 -1.0587372 1.3417342
ACO, acnA 250:1 vs 5:1 -0.4354191 7.1746206
IDH3 250:1 vs 5:1 -0.9513132 5.6105933
LSC1 250:1 vs 5:1 -0.3871476 3.9403641
and here is my code:
ggplot(tca_m, aes(gene,logFC))
last_plot()+geom_bar(aes(fill=tca_m$variable),width = 0.5, stat="identity",position = "dodge")
last_plot()+ coord_flip()
which gives me the following plot:plot.jpg
Now I would like to change color of the bars using a color gradient based upon the value of column logP and follow a different color scheme for two different variable under the variable column. Is this possible using ggplot? Thanks!
