フィルターのクリア

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 Center および File ExchangeLabels and Annotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by