How can I set the default text size on figures in matlab 2018?

19 ビュー (過去 30 日間)
Anders Resell
Anders Resell 2021 年 2 月 27 日
コメント済み: Jan 2021 年 3 月 2 日
I have tried commands such as and set(gca,'FontSize',15) and set(gca,'DefaultTextFontSize',15), but these don't seem to be working well for me.

回答 (1 件)

Jan
Jan 2021 年 2 月 27 日
編集済み: Jan 2021 年 2 月 27 日
The default of an axes works exactly as you have defined it:
figure; axes;
set(gca, 'DefaultTextFontSize', 35)
text(0.5, 0.5, 'Hello')
The default of a figure:
figure('DefaultTextFontSize', 35);
axes;
text(0.5, 0.5, 'hello')
The default of all figures:
set(groot, 'DefaultTextFontSize', 35);
figure; axes;
text(0.5, 0.5, 'hello')
So the actual problem is hidden in:
"but these don't seem to be working well for me."
Please explain, why you are not satisfied with these working methods. Perhaps you do not want to modify the default text font size, but the size of the axes lables or tick marks?
  2 件のコメント
Anders Resell
Anders Resell 2021 年 3 月 2 日
編集済み: Anders Resell 2021 年 3 月 2 日
Sorry for the late reply, and I also think I formulated my question wrong. I wanted to chance the size on figure titles and axis labels, not text in the figure itself. I testet your code and it doesnt seem to chance the size of axis labels.
Jan
Jan 2021 年 3 月 2 日
What exactly are "figure titles"?
I've showed you how to change the defaults for the text font size. The method for changing other defaults is equivalent, e.g. the font size used for axes labels:
figure('DefaultAxesFontSize', 35);
plot(1:10)
For a list of possible settings see:
set(groot, 'Factory')
Replace the "factory" in the names by "Default". It would be a really bad idea to modify the proerpties of groot, but prefer to apply your defaults only to figures, opened by your software. Otherwise Matlab's built-in tools might produce corrputed GUIs.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraphics Object Properties についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by