kztickfix.m
Switches Z axis tick labels to engineering notation by setting the numeric-ruler exponent to a multiple of three and installs a pan/zoom auto-updater.
The function takes the ZAxis ruler of the current axes, which must be a numeric ruler on a linear scale, and sets its Exponent property to 3*floor(log10(max(abs(ticks)))/3), where ticks are the finite non-zero tick values of the ruler, or the finite non-zero axis limits when no such tick values are available. An axis that has no finite non-zero values at all gets a zero exponent, meaning unscaled labels.
To keep the exponent correct under panning and zooming, the function installs its own LimitsChangedFcn on the ruler. Any callback that was already there is stored in the SpinachKZTickFix application data of the axes and is called after every exponent update; function handles, cell arrays and character strings are all supported, the latter being evaluated in the base workspace. Because the previous callback is recognised when it is the one this function installed, repeated calls do not stack: the second call keeps the original user callback rather than chaining another copy of the updater. Updates are skipped if the ruler scale is changed away from linear after installation.
Syntax
kztickfix()
Parameters
none
Outputs
updates the current axis system and installs an auto-updater
See also
kxtickfix.m, kytickfix.m, kzlabel.m, kbox.m, kgrid.m, kfigure.m, Appendix_H:_Matlab_object_overloads
Version 2.13, authors: Ilya Kuprov