Where are the default font settings for sgtitle?

55 visualizaciones (últimos 30 días)
dormant
dormant el 2 de Abr. de 2020
Editada: Adam Danz el 3 de Abr. de 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?

Respuestas (1)

Adam Danz
Adam Danz el 2 de Abr. de 2020
Editada: Adam Danz el 3 de Abr. de 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');

Categorías

Más información sobre Graphics Object Properties en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by