I am plotting means for 8 conditions in a dodged bar graph using geom_bar in ggplot2. My y axis goes from -200 to 1000. Two of the 8 conditions have negative values, the remainder have positive values. Currently the bars for the positive values start at 0. I would want all the bars to start at -200 (i.e. be filled from -200 to their respective values). Is there an easy way to achieve this?
graph <- ggplot(data=data, aes(x, y, fill = z)) +
geom_bar(stat="identity", position = "dodge", width = 0.4) +
scale_y_continuous(limits = c(-200, 1000), breaks =c(-200,0,200,400,600,800,1000), expand = c(0,0))
x has 8 means (4, 423, -57, 724, 14, 556, 37, 614)
I want each of the bars to be filled from -200 to their mean so (-200 to 4, -200 to 423, etc..). At the moment the bars are filled from 0 to their mean. How can I change this?
Thanks