Post-formatting of figures
2 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
采纳的回答
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.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(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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!