xlim add listener 'auto' does not work

3 visualizaciones (últimos 30 días)
Daniel Lemus
Daniel Lemus el 7 de Mayo de 2020
Editada: Adam Danz el 15 de Abr. de 2021
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 comentarios
Daniel Lemus
Daniel Lemus el 7 de Mayo de 2020
Editada: Daniel Lemus el 7 de Mayo de 2020
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 el 15 de Abr. de 2021
Editada: Adam Danz el 15 de Abr. de 2021
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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Labels and Annotations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by