Wrong font size for Default Axes Titles with set(groot,”DefaultAxesTitleFontSize”)
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>R2023asysfontsttf.
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
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: stylingHello,
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>R2023asysfontsttf.
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
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 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>R2023asysfontsttf.
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
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 graphics, latex MATLAB Answers — New Questions