File Exchange

image thumbnail


version (1.54 KB) by Michael Robbins
Produces a plot who's y-axis skips to avoid unnecessary blank space


Updated 12 Nov 2008

View Version History

No License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

Produces a plot who's y-axis skips to avoid unecesary blank space


Cite As

Michael Robbins (2021). BreakPlot (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (9)

Mohamed Baza

I want to use the function with boxplot. I have the following code. How can I call the BreakPlot function to avoid unnecessary blank space
data from 20 to 50 on the y-axis? Here is the code:

A = [59 4.9329;
59 6.8063;
59 4.8889;
61 6.3772;
57 4.8113;
60 4.6193;
59 6.1924;
59 4.0577;
60 7.5035;
58 4.6016;

58 5.0844];



bp = gca;
bp.XAxis.TickLabelInterpreter = 'latex';
xlabel('Data set'')

ylabel('Computation time')

Jessica Faubel

Can someone help me figure out how to get this code to do the same thing, but break the x axis instead? Thanks.

Sindre Søpstad

Had an error in the previous code segmen. Here's the right one:

case 'Line',
% Edit by SS
LW = get(gca,'linewidth');
fill(x+dx/2*[-1 1 1 -1],y+dy*[-3 -2 -1 -2],get(gcf','color'),'EdgeColor',get(gcf','color'),'clipping','off')
line([x-dx/2 x+dx/2 ],[y-2.*dy y-dy ],'clipping','off','linewidth',LW);
line([x-dx/2 x+dx/2 ],[y-3.*dy y-2.*dy],'clipping','off','linewidth',LW);

Caroline Lau


Good。Need Download

John Patrick


Ganquan Mao

Very nice

Aurélien BERTIN

Works very well for my purpose. Most powerfull from my point of vue than breakxaxis for y-axis breaking


Nice function, Michael. I can see this will be very useful.

I found some bugs, though. Try this example:

sampleTimes = [1:200];
RPM = [600+rand(1,100)*500, 9000+rand(1,100)*2500];
breakplot(sampleTimes, RPM, 1500, 8500, 'Line');

I get an error in line 142 with the RESHAPE function.

One question, I don't quite understand the reasoning behind how you get the yticklabel. Can't you simply do this?

set(gca, 'yticklabel', num2str(ytick'));

MATLAB Release Compatibility
Created with R12
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: BreakAxis

Inspired: Break X Axis, Break Y Axis

Community Treasure Hunt

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

Start Hunting!