Apply "Figure Copy Template" within m file code

13 visualizaciones (últimos 30 días)
George Gray
George Gray el 14 de Jun. de 2020
Comentada: Voss el 1 de Oct. de 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 comentarios
George Gray
George Gray el 1 de Oct. de 2023
I had not; thanks for answering!
Voss
Voss el 1 de Oct. de 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!

Iniciar sesión para comentar.

Respuestas (1)

Voss
Voss el 27 de Sept. de 2023
Editada: Voss el 27 de Sept. de 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);

Categorías

Más información sobre Scripts en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by