Apply "Figure Copy Template" within m file code

13 ビュー (過去 30 日間)
George Gray
George Gray 2020 年 6 月 14 日
コメント済み: Voss 2023 年 10 月 1 日
When I copy a figure to paste into a powerpoint file, I usually go to Edit/Copy Options/Figure Copy Template and then click "presentations" and "apply". This makes the figure labels bolded and larger so they show up better in a ppt file, especially when you shrink it down. How do I do that "automatically" from within the m-file? It would seem like there would be a simple function call that I could put into my m-file after I create the figure. I'd put that call in for the figures that I'm most likely to copy over, saving me a bunch of time. But I haven't been able to find anything. Thanks in advance.
  3 件のコメント
George Gray
George Gray 2023 年 10 月 1 日
I had not; thanks for answering!
Voss
Voss 2023 年 10 月 1 日
@George Gray: If my answer solves the problem, please consider Accepting it. Thanks!
Also thanks to @Sebastian for commenting or I wouldn't have seen this three-year-old question!

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

回答 (1 件)

Voss
Voss 2023 年 9 月 27 日
編集済み: Voss 2023 年 9 月 27 日
Here's some code that programmatically applies the default Presentation settings (Change font size to 140% of original, Bold, Set lines' width to 2 points).
% some figure:
f = figure();
plot(1:10)
xlabel('x')
ylabel('y')
title('title')
% settings:
font_size_factor = 1.4;
font_weight = 'bold';
line_width = 2;
% apply the settings:
% 1) increase FontSize by font_size_factor:
obj = findall(f,'-property','FontSize');
fs = get(obj,'FontSize');
fs = num2cell(font_size_factor*vertcat(fs{:}));
set(obj,{'FontSize'},fs);
% 2) set FontWeight to font_weight:
obj = findall(f,'-property','FontWeight');
set(obj,'FontWeight',font_weight);
% 3) set lines' LineWidth to line_width:
obj = findall(f,'Type','line');
set(obj,'LineWidth',line_width);

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by