File Exchange

image thumbnail

BreakXAxis

version 1.0.0.0 (1.64 KB) by Julie Haas
Inserts < // > into a 'broken' or discontinuous x-axis.

65 Downloads

Updated 08 Jul 2003

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.

Cite As

Julie Haas (2020). BreakXAxis (https://www.mathworks.com/matlabcentral/fileexchange/3683-breakxaxis), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (14)

JWall

This is a great function and much better than the other options for doing this! One problem - I can no longer get the resulting breakaxes to behave properly with the command "axis square" which is a problem for me because I'm trying to fit it into a precisely laid out subplot. Setting PlotBoxAspectRatio doesn't work either (two axes show up) so what can I do to fix this? Thanks!

Hi,

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.

Kindly

Konrad

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

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

Joseph

Wow! Great work.

NOTE TO USERS:
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 Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: BreakAxis

Inspired: Break X Axis