Apply "Figure Copy Template" within m file code

13 vues (au cours des 30 derniers jours)
George Gray
George Gray le 14 Juin 2020
Commenté : Voss le 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 commentaires
George Gray
George Gray le 1 Oct 2023
I had not; thanks for answering!
Voss
Voss le 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!

Connectez-vous pour commenter.

Réponses (1)

Voss
Voss le 27 Sep 2023
Modifié(e) : Voss le 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);

Catégories

En savoir plus sur Scripts dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by