How to change the font size in all plots in the live editor (live scripts)?

6 ビュー (過去 30 日間)
Yuki Koyama
Yuki Koyama 2019 年 6 月 26 日
コメント済み: Walter Roberson 2019 年 6 月 26 日
In the live editor, I can get multiple plots together. For example:
x=1:100;
y1=x;
y2=x.^2;
y3=x.^3;
plot(x,y1)
plot(x,y2)
plot(x,y3)
Then I can get the following result:
コメント 2019-06-26 130612.png
Now, my question is "how can I change the all font size in the three plots?"
I can get the result I want by adding the codes as below:
x=1:100;
y1=x;
y2=x.^2;
y3=x.^3;
plot(x,y1)
set(gca,'FontSize',15)
plot(x,y2)
set(gca,'FontSize',15)
plot(x,y3)
set(gca,'FontSize',15)
but I don't want to write the code to change the font size many times.
I want a simpler way to change the font size, or the way to change the default font size in plots.

回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 6 月 26 日
set(findobj(groot, 'type', 'axes'), 'FontSize', 15)
  2 件のコメント
Yuki Koyama
Yuki Koyama 2019 年 6 月 26 日
I tried adding your code to my script in the question, but the result is as below:
無題.png
The font size of only the third plot became bigger. Where did I go wrong?
Anyway, I found the way to change the default font size by the following code:
set(0,'DefaultAxesFontSize', 15)
I was able to change the default font size by using this. Thank you.
Walter Roberson
Walter Roberson 2019 年 6 月 26 日
Livescript creates a new axes for each plot, and it appears to hide some of them. You would need to change the findobj to findall

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by