필터 지우기
필터 지우기

Current figure text interpreter

조회 수: 65 (최근 30일)
jcd
jcd 2023년 11월 3일
답변: Mario Malic 2023년 11월 3일
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?

채택된 답변

Mario Malic
Mario Malic 2023년 11월 3일
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')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by