このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。
小さなグラフのタイトルの設定
MATLAB® グラフィックスでは、タイトルに少し大きなフォントを太字で使用して見やすくしています。このため、Figure ウィンドウ内にテキストが収まらないことがあります。たとえば、次のコードは Figure ウィンドウに収まらない長いタイトルをもつグラフを作成します。
plot(1:10); title(['This is a title that is too long and does not fit',... 'within the extents of the figure window.'])
タイトルのフォント サイズは、Axes の TitleFontSizeMultiplier
と FontSize
のプロパティに基づいています。既定では、FontSize
プロパティは 10 ポイントで、TitleFontSizeMultiplier
は 1.100
です。つまり、タイトルのフォント サイズは 11 ポイントです。
座標軸の他のフォントに影響を与えずにタイトルのフォント サイズを変更するには、Axes の TitleFontSizeMultiplier
プロパティを設定します。
plot(1:10); title(['This is a title that is too long and does not fit',... 'within the extents of the figure window.']) ax = gca; ax.TitleFontSizeMultiplier = 1;
座標軸全体でフォント サイズを小さくするには、FontSize
プロパティを設定します。このプロパティを変更すると、タイトル、目盛りラベル、軸ラベルが存在する場合、これらのフォントが影響を受けます。
plot(1:10); title(['This is a title that is too long and does not fit',... 'within the extents of the figure window.']) ax = gca; ax.FontSize = 8;
フォント サイズをそのままにしてタイトルを 2 行に表示するには、中かっこ {}
と共に cell 配列を使用して複数行のタイトルを定義します。
plot(1:10); title({'This is a title that is too long and does not fit',... 'within the extents of the figure window.'})