How can I listen to changes for dependent properties of graphics objects (> R014a)
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Up to R2014a I was able to listen to pretty much any change in the graphics object properties even when those where not changed directly. In my example, for axes a change in 'XLim' would trigger a change in 'XTick' that would trigger the PostSet event for property 'XTick'.
Since R2014b however this seems not to be the case anymore, the event would get triggered only if the property (e.g. 'XTick') would be directly set. I guess this is linked to the fact that the graphics objects are now similar to MATLAB objects and that 'XTick' is a dependent property.
Here is a typical example:
fig = figure;
ax = axes('Parent',fig);
set(ax,'XTickMode','auto');
drawnow;
hlf = addlistener(ax,'XTick','PostSet',@(~,~) fprintf('\rXTick changed\n'));
xlim(ax,2*get(ax,'XLim'));
drawnow;% Triggers 'hlf' listener only in R2014a and prior
set(gca,'XTick',0:pi/10:2);
drawnow;% Always triggers 'hlf' listener
Is there a way to be notified of the changes of such properties for graphics objects? I would like not to have to listen to all events that could trigger a change in 'XTick' if possible ...
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!