File Exchange

image thumbnail

BreakPlot

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

27 Downloads

Updated 12 Nov 2008

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

Replaces BREAKAXIS

Cite As

Michael Robbins (2020). BreakPlot (https://www.mathworks.com/matlabcentral/fileexchange/21864-breakplot), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (9)

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];


boxplot(A,'Labels',{'$\pi_1$','$\pi_2$'})

%BreakPlot(A,10,40,'Line');

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

ylabel('Computation time')

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

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);

DoubleRL

Good。Need Download

Thanks.

Ganquan Mao

Very nice

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

jiro

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'));

Updates

1.1.0.0

I instituted Jiro Doke's kind bug fix.

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

Inspired by: BreakAxis

Inspired: Break X Axis, Break Y Axis