MATLAB Answers

how to change the font size in a plot (only for the axes numbers)?

조회 수: 2,034(최근 30일)
Kobi
Kobi 22 Aug 2014
댓글: rucha k 28 Jun 2018
as you can see in the attached image i need to change only the size of the numbers not the title or the colorbar how can i do this? thank you

  댓글 수: 1

rucha k
rucha k 28 Jun 2018
How do I resize fonts of scope (xy axes labeling fonts, numbers on axes, etc) in MATLAB 2015a?

로그인 to comment.

채택된 답변

Ben11
Ben11 22 Aug 2014
Use the 'FontSize' property of the current axes:
set(gca,'FontSize',20)

  댓글 수: 5

표시 이전 댓글 수: 2
Ben11
Ben11 22 Aug 2014
Yep for me it works also; i.e. it does the same as @Star Strider. Please see my comment below. OF course I used dummy values for the ticks and titles font size, but you can resize the title after changing the ticks if you like.
Ben11
Ben11 22 Aug 2014
Example code:
clc
clear
x = 1:6*pi;
figure;
plot(x,sin(x));
title('This is sin(x) vs x');
set(gca,'FontSize',18);
outputs this:
What you can do if you want to change the size of the title is assigning it a handle and modify its "FontSize" property directly:
hTitle = title('This is sin(x) vs x');
set(hTitle,'FontSize',30)
Adam
Adam 22 Aug 2014
Be sure to add the title before setting font size. If you change font size then add the title it will be in the font size you just set. Though you can change it again afterwards.

로그인 to comment.

추가 답변(1개)

Adam
Adam 22 Aug 2014
If you search for 'tick labels' or something similar, in the file exchange there are numerous options that replace the tick labels locked into the axes font size with text objects that can be manipulated independently.
I can't vouch for any particular one as I have never used any of them though.

  댓글 수: 0

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

태그

제품


Translated by