Wrong font size for Default Axes Titles with set(groot,​"DefaultAx​esTitleFon​tSize")

10 次查看(过去 30 天)
Hello,
I am trying to define some predefined figure styles by changing groot properties (I was inspired by the Default Property Values documentation). I am using the following syntax:
set(groot,"DefaultObjectTypePropertyName")
This works well for many cases, but I am unable to set correctly the Default Axes Title Font Size when I use LaTeX fonts.
I am using the "mwa_cmr10" font found in <MATLAB root folder>\R2023a\sys\fonts\ttf.
I actually can set the font size to the value I want, but after I divide it by 10.
Here is a MWE.
%% Dummy data
x1 = linspace(0,1,100);
y1 = sin(2*pi*x1);
x2 = linspace(0,1,100);
y2 = sin(4*pi*x2);
set( groot, "DefaultAxesTitleFontSize", 16/10 ); % Dividing the font size I want (16) by 10
set( groot, "DefaultTextInterpreter", "latex" );
set( groot, "DefaultAxesFontName", "mwa_cmr10" );
figure;
hold all
plot(x1, y1);
plot(x2, y2);
xlabel("X")
ylabel("Y")
title("Title")
legend;
gca().Title.FontSize % The font size is 16, but should be 1.6 as it is 16/10
ans = 16
I do not know if this is a bug or not, maybe it has something to do with the 10 in the "mwa_cmr10" font?
I wanted to ask this here first before signaling it as a bug. I think some more obscure graphics properties can be tricky to handle.
Thank you for your attention.
Regards,
Pedro
Edit: styling

回答(1 个)

Walter Roberson
Walter Roberson 2024-8-3
Latex interpreter ignores font names. You control the font by using things like \mathrm \mathsf \mathit \textrm \textsf

类别

Help CenterFile Exchange 中查找有关 Graphics Object Programming 的更多信息

标签

产品


版本

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by