No BSD License  

Highlights from
BreakAxis

4.16667

4.2 | 7 ratings Rate this file 53 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 file inspired Break X Axis, Break Bar Plot, and Break Plot.

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
axis, break(3), graph, graph types(2), plot, plotting, specialized
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (9)
28 Jul 2012 J G

Is it possible to use this for hist function?

28 Jul 2012 J G  
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!

02 Jun 2008 Peter Lustig

Thank you very much!

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]

17 Mar 2008 Mighty Jo

Excellent,
Thank you

21 Jul 2006 Kelvin Chou

Excellent! very helpful function!

14 Jun 2006 Saral Gupta

very efficient, and useful. Nice work

09 Feb 2005 Brett Shoelson

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

Contact us