No BSD License  

Highlights from
BreakAxis

4.0

4.0 | 6 ratings Rate this file 37 Downloads (last 30 days) File Size: 2.76 KB File ID: #3668
image thumbnail

BreakAxis

by Michael Robbins

 

30 Jun 2003 (Updated 01 Jul 2003)

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

| Watch this File

File Information
Description

BreakPlot(x,y,y_break_start,y_break_end,break_type)
Produces a plot who's y-axis skips to avoid unecessary blank space

INPUT
x
y
y_break_start
y_break_end
break_type
   if break_type='RPatch' the plot will look torn
      in the broken space
   if break_type='Patch' the plot will have a more
      regular, zig-zag tear
   if break_plot='Line' the plot will merely have
      some hash marks on the y-axis to denote the
      break

USAGE:
figure;
BreakPlot(rand(1,21),[1:10,40:50],10,40,'Line');
figure;
BreakPlot(rand(1,21),[1:10,40:50],10,40,'Patch');
figure;
BreakPlot(rand(1,21),[1:10,40:50],10,40,'RPatch');
figure;
x=rand(1,21);y=[1:10,40:50];
subplot(2,1,1);plot(x(y>=40),y(y>=40),'.');
set(gca,'XTickLabel',[]);
subplot(2,1,2);plot(x(y<=20),y(y<=20),'.');%

IT'S NOT FANCY, BUT IT WORKS.

Acknowledgements
This submission has inspired the following:
BreakXAxis, Break Bar Plot, BreakPlot
MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (7)
09 Feb 2005 Brett Shoelson

Nice, useful function! Would be nice to have the same for breakxaxis. (With the same patch options.)

14 Jun 2006 Saral Gupta

very efficient, and useful. Nice work

21 Jul 2006 Kelvin Chou

Excellent! very helpful function!

17 Mar 2008 Mighty Jo

Excellent,
Thank you

30 May 2008 Giuseppe Sanfilippo

Well done, but It does not work when y is in a negative scale, i.e. y \in [-1000,0]

02 Jun 2008 Peter Lustig

Thank you very much!

02 Jun 2008 Peter Lustig

One small addition: If your y data has a large range and you want to skip a lot (e.g. several orders of magnitude), then the mid point might not be suitable for breaking. In my case the upper part got way too much range compared to the lower. Can easily be adjusted by tweaking the 'y_break_mid'. I used e.g.

y_break_mid= y_break_end - (y_break_end-y_break_start)./10;

Great code, helped a lot, Michael!

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
specialized Michael Robbins 22 Oct 2008 07:04:04
plotting Michael Robbins 22 Oct 2008 07:04:04
plot Michael Robbins 22 Oct 2008 07:04:04
break Michael Robbins 22 Oct 2008 07:04:04
axis Michael Robbins 22 Oct 2008 07:04:04
graph types Michael Robbins 22 Oct 2008 07:04:04
graph Michael Robbins 22 Oct 2008 07:04:04
break Ameur 31 Jan 2011 14:29:42
break Jared 17 Aug 2011 11:03:30
graph types Tim Gordon 20 Dec 2011 19:25:17

Contact us at files@mathworks.com