Need to set a custom tick label - Bar chart - Numeric values for 'xticklabel' but last tick needs to be alpha characters example - 1,2,3,4,5,6,OAL - How to do
古いコメントを表示
Need to set a custom tick label - Bar chart - Numeric values for 'xticklabel' but last tick needs to be alpha characters example - 1,2,3,4,5,6,OAL - How to do
回答 (1 件)
set(gca,'xticklabel',[num2str([1:6].'); 'OAL'])
NB: are column vector.
ERRATUM
Account for differing string lengths in concatenation; cell strings work for that purpose--
lbl=[{num2str([1:9].','%.1f')};{'OAL'}];
set(gca,'xticklabel',lbl);
2 件のコメント
Jerry Vietinghoff
2015 年 8 月 4 日
編集済み: dpb
2015 年 8 月 4 日
Oh, yeah, the strings aren't same length; use cell strings to handle this...
set(gca,'xticklabel',[{num2str(ty(1:9).','%.1f')};{'OAL'}]);
カテゴリ
ヘルプ センター および File Exchange で Grid Lines, Tick Values, and Labels についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!