Where are the default font settings for sgtitle?

55 vues (au cours des 30 derniers jours)
dormant
dormant le 2 Avr 2020
Modifié(e) : Adam Danz le 3 Avr 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?

Réponses (1)

Adam Danz
Adam Danz le 2 Avr 2020
Modifié(e) : Adam Danz le 3 Avr 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');

Catégories

En savoir plus sur Graphics Object Properties dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by