3
votes

How can I plot only the top portion of a barplot so as to emphasize the difference between the bars without manually calculating the differences and plotting these. I care about the actual values and would thus prefer if these were on the y-axis. It seems like there should be an easy way to accomplish this. If not, I can plot differences and manually change the values which appear on the y-axis.

By changing the ylim I can display the portions of the barplot that have variation, like I want, but part of the bars go through my margins.

barplot(c(54.0, 56.7, 55.9, 59.0), ylim=c(50,60))

The original, less informative plot:

barplot(c(54.0, 56.7, 55.9, 59.0))

Thanks for any help!

1
Did my answer give you the expected result? If so, please consider accepting it, otherwise, please provide some further info so that we can improve it. - sparrow

1 Answers

2
votes

Try xpd = FALSE in your call:

barplot(c(54.0, 56.7, 55.9, 59.0), ylim=c(50,60), xpd = FALSE)
box() #maybe nicer if you add this too

HTH