'Restore View' of Axes does not notify 'PostSet' property listener

10 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2021 年 5 月 18 日
コメント済み: Walter Roberson 2022 年 8 月 7 日
When I create an axes and listener for the 'XLim' property, zooming/panning causes the listener to trigger, but pressing "Restore View" does not trigger the callback. See the example code below:
>> a = axes;
>> addlistener(a, 'XLim', 'PostSet', @(~,~) disp('XLim changed'));
Is there a workaround that also accounts for a change in axis limits caused by "Restore View"?

採用された回答

MathWorks Support Team
MathWorks Support Team 2021 年 5 月 18 日
In MATLAB R2021a, 'LimitsChangedFcn' was added as a callback for 'XAxis,' which should resolve the issue. You can see an example of this below:
ax = axes;
ax.XAxis.LimitsChangedFcn = @limitsChanged
hold(ax, 'on');
plot(ax,1:10);
function limitsCallback(~,~)
  disp('limits changed');
end
  1 件のコメント
Walter Roberson
Walter Roberson 2022 年 8 月 7 日
perhaps have the limit changed function broadcast an event that you have listeners for?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeVisual Exploration についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by