Apply "Figure Copy Template" within m file code

13 views (last 30 days)
George Gray
George Gray on 14 Jun 2020
Commented: Voss on 1 Oct 2023
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 Comments
Voss
Voss on 1 Oct 2023
@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!

Sign in to comment.

Answers (1)

Voss
Voss on 27 Sep 2023
Edited: Voss on 27 Sep 2023
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);

Categories

Find more on Scripts in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!