How can I have ZOOM honor my formatted tick labels?

6 visualizaciones (últimos 30 días)
I know that I can format my tick labels using the AXES' 'xticklabel' and 'yticklabel' properties. However, when I use the "Zoom In" and "Zoom Out" buttons and click on the AXES, the tick labels do not change accordingly. I want to use ZOOM and guarantee that my tick labels update with my desired formatting.

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 24 de Nov. de 2020
Editada: MathWorks Support Team el 24 de Nov. de 2020
The ability to specify ActionPreCallback and ActionPostCallback functions for ZOOM and PAN was added in MATLAB 7.3 (R2006b). This allows you to format the labels after the zoom has been completed, using a callback function. More information and examples are available in the documentation for PAN and ZOOM.
For previous releases, the following is one way you can work around this problem.
NOTE: This workaround uses undocumented features of MATLAB, specifically by modifying the callbacks of some of the figure's toolbar buttons. Therefore, this workaround is not officially supported by MathWorks, Inc.
Basically, this workaround changes the figure's 'WindowButtonDownFcn' to call code that performs the zoom and subsequently sets the tick labels.
To use the workaround, download the "zoomfixticks.m" file.
This MATLAB file function includes help and an example on how to use it.
NOTE: You will have to modify one of the subfunctions to perform the desired ticklabel formatting for your application.
For more information on formatting tick labels in general, see the Related Solutions listed below:

Más respuestas (0)

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by