r - How to change where the horizontal axis crosses the vertical axis in geom_bar? -


here's how want (made in excel): excel example

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

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -