Hi everyone,
I have data with genes with values ranging from 0 to 1. I made a horizontal barplot (like this). I want the middle point should be 0.5 so that bars should go in both direction (like this) (note I want 0.5 to be center point.
Excel can do that easily (as I made this example).
But
Is there a way to do it in ggplot2 or barplot() ?
My code for trial.
Using ggplot2
p<-ggplot(data=data2, aes(x=Gene, y=Ratio, label=Group, color=Group, fill=Group)) +
geom_bar(width = 0.5,stat="identity", position=position_dodge(), size=.3)
p+coord_flip()+ theme_classic()
Using Barplot
barplot(data1, beside=TRUE, horiz=TRUE, col=c("red","blue","orange", "green"), xlim=c(0,max(data1)+0.05))
I tried to find a parameter but could not find one.
I would appreciate any help.
Thanks
No, it is not giving me the desired output
Show us the error if any. I am assuming that the column name would be
Ratio
. Also, changex=Genes
tox=Gene
There is no error. It does not give me the right plot. It gives me this.
I wanted this
I already changed x=Gene.