Filter löschen
Filter löschen

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

19 Ansichten (letzte 30 Tage)
Pedro
Pedro am 3 Aug. 2024 um 16:10
Beantwortet: Walter Roberson am 3 Aug. 2024 um 16:45
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

Antworten (1)

Walter Roberson
Walter Roberson am 3 Aug. 2024 um 16:45
Latex interpreter ignores font names. You control the font by using things like \mathrm \mathsf \mathit \textrm \textsf

Kategorien

Mehr zu Graphics Object Programming finden Sie in Help Center und File Exchange

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by