ticklabelformat - set a dynamic format of axes tick labels

バージョン 1.5.0.0 (5.4 KB) 作成者: Yair Altman
ticklabelformat sets the axes tick labels format. The format is preserved during zoom/pan/maximize
ダウンロード: 2.4K
更新 2015/6/27

ライセンスの表示

ticklabelformat sets the format of an axes tick labels based on sprintf format specifiers. The format is preserved during zoom/pan/maximize and applied to the dynamic tick values.

Calling ticklabelformat with an empty ([] or '') format will revert to Matlab's normal tick labels display behavior.

Syntax:
ticklabelformat(hAxes, axName, format)

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

Examples:
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

Warning:
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:
http://UndocumentedMatlab.com/blog/setting-axes-tick-labels-format
http://UndocumentedMatlab.com/blog/undocumented-hg2-graphics-events

Bugs and suggestions:
Please send to Yair Altman (altmany at gmail dot com)

引用

Yair Altman (2024). ticklabelformat - set a dynamic format of axes tick labels (https://www.mathworks.com/matlabcentral/fileexchange/36254-ticklabelformat-set-a-dynamic-format-of-axes-tick-labels), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2012a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersLabels and Annotations についてさらに検索
タグ タグを追加
謝辞

ヒントを与えたファイル: offsetTicks

Community Treasure Hunt

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

Start Hunting!
バージョン 公開済み リリース ノート
1.5.0.0

fixes suggested by user Robert for R2014b (HG2)

1.4.0.0

fix for R2014b (HG2)

1.3.0.0

updated for R2014b (HG2)

1.1.0.0

Clarified summary & description

1.0.0.0