'Restore View' of Axes does not notify 'PostSet' property listener
조회 수: 10 (최근 30일)
이전 댓글 표시
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
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
2022년 8월 7일
perhaps have the limit changed function broadcast an event that you have listeners for?
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Visual Exploration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!