#author("2025-05-02T06:34:53+09:00","default:Miyashita","Miyashita")
#author("2025-05-02T06:35:06+09:00","default:Miyashita","Miyashita")
* datetime 軸の目盛りフォーマット修正 [#k5db5fb9]
** 概要 [#ied06d1f]
日本語で MATLAB を使用していて datetime 軸を使うと,デフォルトでは'MM月dd日' みたいな日本語表記が入ってこのままだと国際的には使いにくいので.

** xtickformat [#m1606fd8]
x軸が datetime だとしたら,原則は [[xtickformat>https://jp.mathworks.com/help/matlab/ref/xtickformat.html]] を使う.例えば
#codeprettify(lang-matlab){{
xtickformat('MM/dd')
}}
で 01/30 のような表記になる.


** secondary label の yyyy 年を yyyy に [#pa31c047]
月単位,日単位の図を描いた時に,secondary label に「yyyy年」という文字が現れる.~
「年」という文字を抜きたければ,ax をなんらかの Axes オプジェクトだとして
#codeprettify(lang-matlab){{
    ax.XAxis.SecondaryLabelFormat = 'yyyy';
ax.XAxis.SecondaryLabelFormat = 'yyyy';
}}
のようにする.

Front page   Edit Diff Attach Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes