필터 지우기
필터 지우기

Unable to change font image and latex interpreter

조회 수: 9 (최근 30일)
Lieke
Lieke 2024년 1월 8일
댓글: Lieke 2024년 1월 11일
I'm new at learing matlab and I can't seem to change the font of an image.
I'm usig the following code:
C = [0 2 4 6; 8 10 12 14; 16 18 20 22];
imagesc(C);
ylabel('Scan Number', 'Interpreter', 'latex', 'FontName', 'Times New Roman');
xlabel('Q ($\rm{\AA}^{-1}$)', 'Interpreter', 'latex', 'FontName', 'Times New Roman');
set(gca, 'Fontsize', 12, 'FontName', 'Times New Roman');
get(gca, 'fontname')
ans = 'Times New Roman'
The get gca give me the correct font however it doesn't seem to change in the figure. The font also does not seem to change when I change it in the latex interpreter. However I am able to chage the fontsize I want to plot the symbol angstrom ^-1 in the xlabel that is why I'm using the late interpreter. I don't really mind what font it is in but now the fonts are differerent in labels and the ticks numbers and legend. I would like it to be the same font. I would appreciate any insights for either of these issues!
  댓글 수: 2
Dyuman Joshi
Dyuman Joshi 2024년 1월 8일
I don't think fonts are supported in Latex Interpreter in MATLAB. If you want to implement that, you will have to write code for that, which will be a daunting task.
As for the matching of axis labels and tick labels, you can change the Tick label interpreter to latex as well -
C = [0 2 4 6; 8 10 12 14; 16 18 20 22];
imagesc(C);
ylabel('Scan Number', 'Interpreter', 'latex')
xlabel('Q ($\rm{\AA}^{-1}$)', 'Interpreter', 'latex')
set(gca, 'Fontsize', 15, 'TickLabelInterpreter', 'latex');
Lieke
Lieke 2024년 1월 11일
Thank you for you answer. That works!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by