Using ggplot2, can I insert a break in the axis?

As noted elsewhere, this isn’t something that ggplot2 will handle well, since broken axes are generally considered questionable.

Other strategies are often considered better solutions to this problem. Brian mentioned a few (faceting, two plots focusing on different sets of values). One other option that people too often overlook, particularly for barcharts, is to make a table:

enter image description here

Looking at the actual values, the 500 doesn’t obscure the differences in the other values! For some reason tables don’t get enough respect as data a visualization technique. You might object that your data has many, many categories which becomes unwieldy in a table. If so, it’s likely that your bar chart will have too many bars to be sensible as well.

And I’m not arguing for tables all the time. But they are definitely something to consider if you are making barcharts with relatively few bars. And if you’re making barcharts with tons of bars, you might need to rethink that anyway.

Finally, there is also the axis.break function in the plotrix package which implements broken axes. However, from what I gather you’ll have to specify the axis labels and positions yourself, by hand.

Leave a Comment