Current figure text interpreter

65 views (last 30 days)
jcd
jcd on 3 Nov 2023
Answered: Mario Malic on 3 Nov 2023
I want to change the text interpreter of all the text (ticks, axis labels, legends, annotations, etc) in my current figure (saved as hFig = figure;) to LaTeX. Currently, I use
set(groot,...
'defaulttextinterpreter','latex',...
'defaultAxesTickLabelInterpreter','latex',...
'defaultLegendInterpreter','latex')
but I don't want to affect future figures. So far I can only modify the ticks in the current figure using
set(gca, 'TickLabelInterpreter', 'latex')
Is there a way to do it for every text shown in the current figure?

Accepted Answer

Mario Malic
Mario Malic on 3 Nov 2023
Hi, here's an example
fig = figure();
subplot(2,1,1);
x = linspace(0,10);
y1 = sin(x);
plot(x,y1)
legend("ax_1");
subplot(2,1,2);
y2 = sin(5*x);
plot(x,y2)
legend("ax_2")
legH = findall(fig, "Type", "legend");
set(legH, "Interpreter", 'latex')
axesH = findall(fig, "Type", "axes");
set(axesH, "TickLabelInterpreter", 'latex')

More Answers (0)

Categories

Find more on Printing and Saving in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!