Fast and easy axis break

조회 수: 1 (최근 30일)
A T
A T 2014년 6월 25일
댓글: dpb 2014년 6월 25일
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
dpb
dpb 2014년 6월 25일
I worked out a solution for the indexing issues, not sure what, precisely, you mean/want on the "axis break" part???

댓글을 달려면 로그인하십시오.

답변 (1개)

dpb
dpb 2014년 6월 25일
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...

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by