Code covered by the BSD License  

Highlights from
ticklabelformat - set a dynamic format of axes tick labels


5.0 | 2 ratings Rate this file 52 Downloads (last 30 days) File Size: 5.01 KB File ID: #36254
image thumbnail

ticklabelformat - set a dynamic format of axes tick labels



18 Apr 2012 (Updated )

ticklabelformat enables setting the axes tick labels format. The format is preserved during zoom/pan

| Watch this File

File Information

ticklabelformat enables setting the format of an axes tick labels based on sprintf format specifiers. The format is preserved during zoom/pan and applied to the dynamic tick values.
Calling ticklabelformat with an empty ([] or '') format will revert to Matlab's normal tick labels display behavior.

Input Parameters:
     hAxes - handle to the modified axes, such as returned by the gca function
     axName - name(s) of axles to modify: 'x','y','z' or combination (e.g. 'xy')
     format - format of the tick labels in sprintf format (e.g. '%.1f V') or a
                 function handle that will be called whenever labels need to be updated
     ticklabelformat(gca,'y','%.6g V') - sets y axis in current axes to display 6 significant digits
     ticklabelformat(gca,'xy','%.2f') - sets x & y axes in current axes to display 2 decimal digits
     ticklabelformat(gca,'z',@myFcn) - sets a function to update the Z tick labels in current axes
     ticklabelformat(gca,'z',{@myFcn,extraData}) - sets an update function as above, with extra data
     This code heavily relies on undocumented and unsupported Matlab functionality. It works on Matlab 7+, but use at your own risk!
Technical description and more details:
Bugs and suggestions:
     Please send to Yair Altman (altmany at gmail dot com)

MATLAB release MATLAB 7.14 (R2012a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
11 Jul 2013 Jorge Arcila Zea

Excellent script. It was very useful. Thank you for share it

17 May 2012 Mayi

Very good, I have use it in my application. Tanks

20 Apr 2012

Clarified summary & description

02 Oct 2014

updated for R2014b (HG2)

Contact us