필터 지우기
필터 지우기

xlim add listener 'auto' does not work

조회 수: 2 (최근 30일)
Daniel Lemus
Daniel Lemus 2020년 5월 7일
편집: Adam Danz 2021년 4월 15일
Hi
I am using 2019b and have not been able to successfully use an evenlistener on the XLim of my axes. I want to listen to changes on the size of the axes but it seems it does not work when the XLimMode = 'auto' altough there is a clear change in XLim. Looking abit more on the issue I found a workaround (https://nl.mathworks.com/matlabcentral/answers/369377-xlim-listener-for-zoom-reset-and-linkaxes-strange-behavior) which I presume does not work anymore in this release.
addlistener(parent_ax,'XLim','PostSet',@ReposFootPrint); % This only works when XLimMode = 'manual'
This alternative using a manual property does not work given that the propety is not SetObservable
addlistener(struct(parent_ax).XAxis,'Limits','PostSet' ,@ReposFootPrint);
Any ideas on how can I use the listener in 'auto' mode?
Thank you
  댓글 수: 4
Daniel Lemus
Daniel Lemus 2020년 5월 7일
편집: Daniel Lemus 2020년 5월 7일
Fig 1. Original Placement of footprint @(1,1)
Fig 2. After ploting a new line
plot(parent_ax,[0 2],[0 2])
the listener was not triggered
Fig 3. The callback ReposFootPrint is triggered once the XLim property is manually set, placing back the footprint to its original location (this should be automatic)
Adam Danz
Adam Danz 2021년 4월 15일
편집: Adam Danz 2021년 4월 15일
In Matlab r2021a and later, see this community highlight for a demonstration of the new LimitsChangedFcn that is easier to use and more reliable than applying a listener to the xlim property. The demo moves a text object any time the axis limits change. That can easily be applied to your footprints.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Labels and Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by