Tim*_*im 5 matlab plot figure matlab-figure
我正在尝试将一些Matlab图组合成一个图,因此我想知道如何在我的图上方创建"普通"图块而不是Matlab提供的粗体图标.下面是一个例子.
figure
plot((1:10).^2)
title({'First line';'Second line'})
Run Code Online (Sandbox Code Playgroud)
利用这个'FontWeight'论点:
figure
plot((1:10).^2)
title({'First line';'Second line'},'FontWeight','Normal')
Run Code Online (Sandbox Code Playgroud)
另请注意,您可以'FontWeight'一次性访问图中所有文本对象的参数 - 如果您在图中有多个子图,则使用findall:
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')
Run Code Online (Sandbox Code Playgroud)
如上述评论所述; 对于单个数字标题,您可以使用\rm作为替代.但请注意,这\rm取决于'Interpreter'as 的(默认)选择'tex',而上述方法对所有解释器选项都有效(但对使用解释器的文本对象没有影响'latex').