File Exchange

image thumbnail


version 1.0 (1.64 KB) by

Inserts < // > into a 'broken' or discontinuous x-axis.

8 Ratings



View License

h=BreakXAxis(x,y,start,stop,width) plots (x,y) and breaks the plot's x-axis between <start> and <stop>, by inserting a broken-axis symbol < // > into a space <width> wide. This type of plot is often used in scientific papers, when the data between <start> and <stop> isn't interesting. The code can be easily modified (swap y for x) to break the y-axis.

Comments and Ratings (11)

chengshou lai

Konrad Tarka


i have trouble getting this function work properly.

I have a two 3631x1 double matrices (x1 and y1) that I want to plot with a break in the X-axis.

Whe I try to use this function by:

BreakXAxis(x1,y2,1750, 2500,1);

Matlab complains that there is not the correct amount of arguments. From what I can see there should be 5.

Could anyone get me on track, as this seems to be a great function.



Great program. Does exactly what I needed!

I don't understand how you can do the same on y-axis. Can you explain? What do I have to change in code? Thanks

Richard Rieber

Richard Rieber (view profile)

Great function. I was trying to do this for a bar chart, so it doesn't apply. Seems like it would be simple to adapt. However, I did notice that the function uses max(ytick) to calculate where to put the '//' on the upper x-axis. This may not work in cases where the maximum ytick is not on the upper y-axis. Perhaps use:

> v = axis;
> t2 = text(start+width/2,v(4),'//','fontsize',15);

Ashok Reddy

Nice work. Any later version of Matlab has such a functionality built-in?

alex marin

Nice, but the break mark on the x axis does not have a "professional" look as in e/g/ origin.


Joseph (view profile)


Joseph (view profile)

Wow! Great work.

i) it is usually desirable to have width as small as feasible

ii)it's really easy to add your own style text parameter to the function so that you can do more than the default blue dot.

REALLY GREAT !!! A manager at our company really loved it -- need I say more!

MATLAB Release
MATLAB 6.5 (R13)

Inspired by: BreakAxis

Inspired: Break X Axis

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video