フィルターのクリア

Post-formatting of figures

3 ビュー (過去 30 日間)
Kai
Kai 2024 年 3 月 29 日
コメント済み: Voss 2024 年 3 月 29 日
Hello all,
Some time ago, I saved some figures. Now that I want to use them, I am wondering if I can change the text size and color afterwards. It is not easy to read.
I found this, but I am not sure if it works on an already existing figure. Does anyone have any ideas? Due to its size I cannot attach the .fig file here, so I added a screenshot.
Many thanks!

採用された回答

Voss
Voss 2024 年 3 月 29 日
You can open the saved figure with the openfig function.
f = openfig('figure1.fig');
You can modify any property of the figure or anything in the figure. But you have to know how to find the object(s) you want to modify. findall can be used for that.
For example, modify the colors and sizes of the x/yticklabels of the axes:
f = openfig('figure1.fig');
ax = findall(f,'Type','axes')
ax =
Axes (title) with properties: XLim: [0 10] YLim: [1 10] XScale: 'linear' YScale: 'linear' GridLineStyle: '-' Position: [0.1300 0.1100 0.7750 0.8150] Units: 'normalized' Use GET to show all properties
ax.XColor = [0 1 1]; % cyan
ax.YColor = [1 0 1]; % magenta
ax.FontSize = 16; % font size of all tick labels
The axes x/ylabels and titles are text objects, so you can use findall to find all text objects in the figure, then modify their properties:
t = findall(f,'Type','text')
t =
3×1 Text array: Text (title) Text (x) Text (y)
t(1).Color = [1 0 0]; % make title red
t(2).Color = [0 1 0]; % make xlabel green
t(3).Color = [0 0 1]; % make ylabel blue
set(t,'FontSize',16) % make all 3 into 16-point size
  2 件のコメント
Kai
Kai 2024 年 3 月 29 日
Many thanks! that's what I was looking for
Voss
Voss 2024 年 3 月 29 日
You're welcome!

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by