Where are the default font settings for sgtitle?

조회 수: 49 (최근 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 CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by