缩小图形标题
MATLAB® 图形标题使用加粗的微大字体,以便更醒目。因此,图窗窗口中可能无法容纳长标题。例如,此代码创建一个绘图,其中的长标题无法容纳在图窗窗口范围内。
plot(1:10); title(['This is a title that is too long and does not fit', ... 'within the extents of the figure window.'])
标题字体大小取决于坐标区的 TitleFontSizeMultiplier
和 FontSize
属性。默认情况下,FontSize
属性为 10 磅,而 TitleFontSizeMultiplier
为 1.100
,这意味着标题字体大小为 11 磅。
若要更改标题字体大小而不影响坐标区的其他部分文本,请设置坐标区的 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;
若要跨两行显示标题,请使用带有花括号 {}
的元胞数组定义多行标题。
plot(1:10); title({'This is a title that is too long and does not fit', ... 'within the extents of the figure window.'})