Break X Axis

Version (22.1 KB) by Peter
Splits the x-axis into 2 disjoint regions in order to hide an uninteresting portion of a figure.
Updated 6 Aug 2013

View License

1.) Minimal fuss, just works
2.) Professional looking graphs
3.) Works with all 2D graphics objects: Lines, Text, Patches, Images, etc.
5.) Obeys ‘XTickMode’ for automatic or manual positioning of tick marks.
6.) Obeys ‘Layer’ property
7.) Works with semilogy plots and with either axis reversed
8.) Can resize after splitting axis
8.) Possible to unsplit axis

1.) No support for semilogx or loglog plots
2.) Creates extra copies of the data which may be problematic when displaying very large data sets.
3.) Text inside an axes must have 'Clipping' turned 'Off' or be added after splitting the axis. Otherwise it may be rendered twice. See TextExample.m for more details.

Cite As

Peter (2024). Break X Axis (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Axes Appearance in Help Center and MATLAB Answers

Inspired by: BreakAxis, BreakXAxis, BreakPlot

Inspired: Aesethetic Axis Breaks, Break Y Axis

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

Added a screen shot

Fixed a bug that caused plots to be misaligned in some complex figures.