I am trying to create a bar graph of odds ratios. Interpretationally, they are centered around 1, not 0. Therefore, I would like to have a bar graph where values below 1 are "negative" and values above 1 are "positive" (i.e., a graph of distance from 1).
Effectively, the graph should look like the following plot except that the labels on the y axis should be centered around 1, not 0.
I would like to create this graph not be relabeling of the y axis, but by actually centering it around 1. Is this possible; and if so, how?
Code to create the example graph:
data <- matrix(c(rnorm(5, 1, .5)), 5, 1)
data <- as.data.frame(data)
data[,2] <- data[,1] - .1
data[,3] <- data[,1] + .1
data <- cbind(c(letters[1:5]), data)
names(data) <- c("Category", "OR", "Lower", "Upper")
data.zero <- cbind("Category"=data[,1], data[,2:4] - 1)
require(ggplot2)
ggplot() +
geom_bar(data = data.zero, aes(x=Category, y=OR, fill=Category), stat = "identity") +
scale_fill_brewer(type = "seq", palette = 1) +
geom_errorbar(aes(x=Category, y=OR, ymin=Lower, ymax=Upper),
width=.1, position=position_dodge(), data=data.zero)