Problem related to locked axis.

조회 수: 2 (최근 30일)
Rafael Freire
Rafael Freire 2017년 11월 2일
댓글: Rafael Freire 2017년 11월 2일
I am having a problem related to the locked axis. I have a figure with a plot i.e. sin(x). Then I MANUALLY zoom in on an interested region (ROI). For i.e. [9 12 -1 -0.4]. After I press the button 'Test' I plot a statement in the same figure (not holding on) like for ie. cos(x) and I want to automatically go (zoom in) to my ROI. With the bottom code it works, but when I want to see the full view of the plot by double-clicking in the Zoom in, ou using the Zoom out, the axis is lockedon that region and I can't check the whole plot again. Any Help? Thanks in advance
figure
x=1:20;
plot(x, sin(x))
h = uicontrol('units', 'normalized','Position',[0.02 0.05 0.07 0.1],'String','Test');
h.Enable = 'Inactive';
h.ButtonDownFcn = ['axzoom=axis; '...
'cosx=cos(x);'...
'plot(x, cosx, ''r'');'...
'axis(axzoom);'];
  댓글 수: 6
Adam
Adam 2017년 11월 2일
편집: Adam 2017년 11월 2일
Forward compatibility is far less constraining than backwards compatibility. The latter implies never using any of the new functionality that has come out since the version you want to be backward compatible with, or constantly providing branched code to deal with older versions. For people writing code for the File Exchange this may be important, but for a company like mine we upgrade to the new version each time and even if we didn't we would never go back to an older version than the one we have right now, even if, for some reason, we stopped upgrading.
As with most things in software engineering, it all depends on what you need. Making code compatible with things it doesn't need to be compatible with, writing code more generic than it needs to be, adding features that you might want in the future, but don't need right now, etc, can all add time to development that is unnecessary.
So our company's code is aimed to be usable in R2017a and R2017b. I certainly pity anyone who has to make all their code compatible with every version back to R2006a, which is, coincidentally, the first version I started working with I think!
Rafael Freire
Rafael Freire 2017년 11월 2일
Thank you for this comment. It will help me in the future.

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

답변 (1개)

Adam
Adam 2017년 11월 2일
Adding
zoom reset
after plotting the original will remember that as the current zoom which it will then zoom back out to. I have still had problems in the past even when using this, but I can't remember the exact scenario is or whether they would be relevant to what you are doing. I was programming manuall zoom callbacks and a variety of other things too.
  댓글 수: 4
Rafael Freire
Rafael Freire 2017년 11월 2일
no, the axis are still locked... Is there a way to unlock the X Y axis using set(gca,...)?
Rafael Freire
Rafael Freire 2017년 11월 2일
편집: Rafael Freire 2017년 11월 2일
It is strange because if you use hold on on the button code, it will work. Also if you use the code not inside the button it will work too... I really don't know what is going on...

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

카테고리

Help CenterFile Exchange에서 Visual Exploration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by