Fast and easy axis break
3 次查看(过去 30 天)
显示 更早的评论
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
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
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...
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!