Reputation: 690
Is it possible to make a barplot start from a number other than 0 in base R graphics and to then plot values beneath this startpoint? For example, I would like to create a barplot where the origin on the y-axis is 1 and then to draw boxes that go up to 4 and down to -3.
For example, I would like to draw this barplot starting from 1, instead of drawing the bars from 0.
barplot(c(4,-3))
This question is distinct from: Different Starting Point (not 0) in barplot Y-Axis?, which only plots values above a startpoint different from 0. I would like to plot them below the new startpoint.
Upvotes: 1
Views: 2596
Reputation: 226871
One hackish possibility -- tweak the values and adjust the axis accordingly:
barplot(c(4,-3)-1,axes=FALSE)
axis(side=2,at=(-3:4)-1,labels=(-3:4))
abline(h=0)
Upvotes: 3