필터 지우기
필터 지우기

[Solved] Trouble changing font of plot titles?

조회 수: 26 (최근 30일)
Kristina Collins
Kristina Collins 2020년 11월 12일
편집: Kristina Collins 2020년 11월 12일
Hi folks,
I'm trying to unify the fonts I'm using in a paper, and am coming to the conclusion that I'm missing something important about how fonts work in MATLAB. I can get the ticks and legends to be in my desired font, but not the titles and axis labels.
Behold:
%% Broken font settings, minimum working example
set(0, 'DefaultAxesFontName', 'Highway Gothic')
x=1:.01:2;
y=sin(x);
figure
plot(x, y)
title("This should be in Highway Gothic", 'FontName', 'Highway Gothic')
ylabel("I can change font size...", 'FontName', 'Highway Gothic', 'FontSize', 20)
xlabel("...but not typeface?", 'FontName', 'Highway Gothic')
legend('why does this work?')
This produces the following:
...and, to top it off, something I did seems to have changed elements of my MATLAB interface (the file list in the "Current Folder" pane, the list of variables in the workspace, and the text of dialog boxes) to Highway Gothic. I don't mind this much because it's a good font, but....wat?
  댓글 수: 2
Walter Roberson
Walter Roberson 2020년 11월 12일
I notice that the default Interpreter property for title and labels is 'tex', which can interfere with getting the font you expect. I suggest you add 'Interpreter', 'none' to the calls.
Kristina Collins
Kristina Collins 2020년 11월 12일
That fixed it. Thanks!

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

채택된 답변

Walter Roberson
Walter Roberson 2020년 11월 12일
I notice that the default Interpreter property for title and labels is 'tex', which can interfere with getting the font you expect. I suggest you add 'Interpreter', 'none' to the calls.
[Copied from comment as it turned out to be the answer]

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by