Break in the axis

648 views (last 30 days)
Niles Martinsen
Niles Martinsen on 2 Jul 2012
Answered: yanan LIU on 29 Feb 2020
I have a plot of data points (x, y). The issue is that one of the first data points has a very large amplitude, whereas the rest of the data points have very small magnitudes. So what I thought that I wanted to do is to make a "cut" in the y-axis, such that it goes from 0..1 and then skips to 100..105. Perhaps with a mark such as this "----//----" in between.
Is that possible in MatLAB?
Best, Niles.

Accepted Answer

Thomas on 2 Jul 2012
Edited: Thomas on 2 Jul 2012

More Answers (3)

yanan LIU
yanan LIU on 29 Feb 2020
There is no direct function as I know.
But you can try to plot the double line on your figure.
for example,
axes('Position',[.1 .78 .05 .05]);
px=[1 5];
py1=[1 2];
plot(px,py1,'k','LineWidth',2);hold all;
plot(px,py2,'k','LineWidth',2);hold all;
fill([px flip(px)],[py1 flip(py2)],'w','EdgeColor','none');
box off;
axis off;
Then you can get the follow figure.

Peter on 1 Aug 2013

Philippe Lebel
Philippe Lebel on 22 Aug 2018
It does EXACTLY what you want to do.
  1 Comment
Walter Roberson
Walter Roberson on 22 Aug 2018
That's what Thomas suggested 6 years ago.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!