How can I have ZOOM honor my formatted tick labels?

8 次查看(过去 30 天)
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.

采纳的回答

MathWorks Support Team
编辑:MathWorks Support Team 2020-11-24
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:

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Axis Labels 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by