如何"取消"MATLAB图形的粗体标题?



我正试图将几个Matlab绘图组合成一个图形,因此我想知道如何在绘图上方创建"正常"瓷砖,而不是Matlab提供的粗体标题。下面是一个例子。

figure
plot((1:10).^2)
title({'First line';'Second line'})

使用'FontWeight'参数:

figure
plot((1:10).^2)
title({'First line';'Second line'},'FontWeight','Normal')

还请注意,您可以使用findall:一次访问图中所有文本对象的'FontWeight'参数,以防您的图中有几个子图

myFig = figure;
subplot(2,1,1)
plot((1:10).^2)
title('First plot')
subplot(2,1,2)
plot((1:10).^2)
title('Second plot')
% Set 'Normal' font weight in both titles above
set(findall(myFig, 'Type', 'Text'),'FontWeight', 'Normal')

如上文评论所述;对于单个图形标题,可以使用rm作为替代。然而,请注意,rm取决于'Interpreter'作为'tex'的(默认)选择,而上述方法对解释器的所有选择都有效(但对使用解释器'latex'的文本对象无效)。

最新更新