Where are the default font settings for sgtitle?

48 ビュー (過去 30 日間)
dormant
dormant 2020 年 4 月 2 日
編集済み: Adam Danz 2020 年 4 月 3 日
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?

回答 (1 件)

Adam Danz
Adam Danz 2020 年 4 月 2 日
編集済み: Adam Danz 2020 年 4 月 3 日
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');

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by