You could just change the labels manually, as shown in the other answer. However, I think conceptually the better solution is to define a transformation object that transforms the y axis scale as requested. With that approach, you're literally just modifying the relative baseline for the bar plots, and you can still set breaks and limits as you normally would.
df <- data.frame(values = c(1,2,0), labels = c("A", "B", "C"))
t_shift <- scales::trans_new("shift",
transform = function(x) {x-1},
inverse = function(x) {x+1})
ggplot(df, aes(x = labels, y = values, fill = labels, colour = labels)) +
geom_bar(stat="identity") +
scale_y_continuous(trans = t_shift)
Setting breaks and limits:
ggplot(df, aes(x = labels, y = values, fill = labels, colour = labels)) +
geom_bar(stat="identity") +
scale_y_continuous(trans = t_shift,
limits = c(-0.5, 2.5),
breaks = c(0, 1, 2))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…