Fast and easy axis break

4 views (last 30 days)
A T
A T on 25 Jun 2014
Commented: dpb on 25 Jun 2014
My problem is that I have 540 data points out of which I take data for graphing by groups of 30 (so 18 graphs) for one dataset. Sometimes I need axis breaks - sometimes on the x axis, sometimes on the y-axis, sometimes both; the position of the breaks also varies. I know there are file exchange contributions, but all of them take a lot of time, to write for each graph. I have also tried with the subplot command - but it gives me an error:()-indexing must appear last in an index expression. Which I think occurs because I call my data in groups.
So my script looked something like this:
subplot(2,1,1);plot(x(31:60)(y(31:60)>=160),y(31:60)(y(31:60)>=160),'.');
set(gca,'XTickLabel',[]);
subplot(2,1,2);plot(x(31:60)(y(31:60)<=20),y(31:60)(y(31:60)<=20),'.');
How can I work around this problem.
  1 Comment
dpb
dpb on 25 Jun 2014
I worked out a solution for the indexing issues, not sure what, precisely, you mean/want on the "axis break" part???

Sign in to comment.

Answers (1)

dpb
dpb on 25 Jun 2014
plot(x(31:60)(y(31:60)>=160),y(31:60)(y(31:60)>=160),'.');
becomes
i1=31; i2=60; % the ranges for the case
yLim=160; % and the test value
x1=x(i1:i2); y1=y(i1:i2); % make a temporary for the range
ix=(y1>=yLim); % the logical array inside the temporary
plot(x1(ix),y1(ix),'.');
Now you can simply update i1, i2 and yLim for each case...

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!