r - How to change where the horizontal axis crosses the vertical axis in geom_bar? -
here's how want (made in excel): 
and here's template code:
library(ggplot2) data <- c(0.3,0.4,0.5,0.6,0.7,0.8) qplot(x=1:6, y=data, geom="bar", stat="identity") edited after commenter suggested need more words in question:
my code above draws x-axis @ y=0 bars go axis. want x-axis @ y=0.5 , want bars values < 0.5 go down, while bars values > 0.5 go up. in excel plot have placed above.
hopefully makes sense.
it little fiddly, possible:
qplot(x=factor(1:6,levels=6:1), y=data-0.5, geom="bar", stat="identity") + scale_y_continuous(breaks=seq(-0.5,0.5,0.1),labels=seq(0,1,0.1),limits=c(-0.5,0.5))
Comments
Post a Comment