Where are the default font settings for sgtitle?

48 Ansichten (letzte 30 Tage)
dormant
dormant am 2 Apr. 2020
Bearbeitet: Adam Danz am 3 Apr. 2020
I'm trying to set default values to apply to number of plots, like this
set(groot,'DefaultAxesFontSize', 20);
set(groot,'DefaultAxesFontWeight', 'bold');
set(groot, 'DefaultLineLineWidth', 1);
set(groot, 'DefaultAxesLineWidth', 2);
set(groot,'DefaultLineMarkerSize', 8);
This works on eveything except the grid title created using sgtitle.
Are the defaults for sgtitle set somewhere else?

Antworten (1)

Adam Danz
Adam Danz am 2 Apr. 2020
Bearbeitet: Adam Danz am 3 Apr. 2020
sgtitle doesn't appear to use the default fontsize properties I tested: DefaultAxesFontSize, DefaultTextFontSize, DefaultUicontrolFontSize, DefaultUipanelFontSize (the last two were a long shot).
Axes lables and titles use a default multiplier applied to the default fontsize but the subplottext object created by sgtitle is a child to the figure, not the subplot axes. The method matlab.graphics.illustration.subplot.Text() is used to generate the subplottext object but I can't dig any deeper to determine what defines the default values.
To work around this, you can set the fontsize after generating the titles.
% Scale the sgtitle fontsize to equal the subplot title fontsize
sg = sgtitle('SuperTitle');
sg.FontSize = get(groot, 'DefaultAxesFontSize') * get(groot, 'factoryAxesTitleFontSizeMultiplier');

Kategorien

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

Community Treasure Hunt

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

Start Hunting!

Translated by