Effacer les filtres
Effacer les filtres

Zoom in function make the both axis labeled wrongly

1 vue (au cours des 30 derniers jours)
MingCheng Zhang
MingCheng Zhang le 31 Jan 2021
Commenté : MingCheng Zhang le 7 Fév 2021
Hi,
I have some problem with the "zoom in" function in figure. Initially the figure is pop-up, the x and y axis are labelled correctly, from 0 to xlim/ylim. However, when I use the zoom in function, I reaslied that the both axis are wrong, i.e. there are two zeros on x-axis. I have uploaded the pictures as attached references. Please help me on the problem. The MATLAB version is R2019b.
Thank you for any help,
Yours sincerely,
MingCheng

Réponse acceptée

Shubham Khatri
Shubham Khatri le 2 Fév 2021
Hello,
You are manually setting the tick labels. When you zoom these will no longer get auto updated so you will likely end up with a mess as these tick labels get applied to totally different ticks after the zooming.
Manually setting tick labels does not go well with zooming. You'd have to add your own post-zoom callback to recalculate the tick labels for the new ticks I would think.
Take a look at
doc zoom
In particular the section on Zoom mode callbacks and the use of the zoom mode object. You can do some useful things with this object, including two that are of interest:
ActionPreCallback
ActionPostCallback
Setting these allows you to define behaviour that happens before and after the actual zooming.
You may want to set the XTickLabelMode to auto in the pre callback and then insert the code you have above that over-rides labels into the ActionPostCallback in order to have them corrected each time you zoom.
Hope it helps.
  1 commentaire
MingCheng Zhang
MingCheng Zhang le 7 Fév 2021
Thank you very much I will explore on the zoom documentation

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Visual Exploration dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by