Bump --> How to change tick label fonts in Matlab figure

조회 수: 35 (최근 30일)
Sheikh
Sheikh 2015년 2월 25일
댓글: Shoaibur Rahman 2015년 2월 26일
I am plotting a bode diagram of transfer functions. I want the "tick label" fonts of both the magnitude plot and phase plot to be of size 20 and to be black color. For some reason the tick label font size of the magnitude plot is always small. And the tick label font color is grey. It would be great help if someone could point me towards a way of doing it.
The code is as follows:
s = tf('s');
tf1 = s/(s+1); tf2 = (s+2)/(s^2+2*s+3);
figure; hold on;
bode(tf1,'b',tf2,'r');
object_handles2 = findall(gcf);
c1d = findobj(object_handles2,'Type','text');
c2d = findobj(object_handles2,'Type','line');
set(c1d,'FontSize',20,'FontWeight','bold','color',[0 0 0])
set(gca,'FontSize',20,'FontWeight','bold')
set(gcf,'Position',[100 0 700 700])
set(c2d,'LineWidth',2);
hold off;

채택된 답변

Shoaibur Rahman
Shoaibur Rahman 2015년 2월 25일
Here is an example on how you could use set function to accomplish your job. Delete any pairs of input arguments if not required.
set(gca,'FontName','Verdana','Fontsize',20,'XColor','k','YColor','r')
  댓글 수: 2
Sheikh
Sheikh 2015년 2월 25일
Thanks. But it is still not changing the tick labels of the magnitude plot. Tick labels only on the phase plot is changing. Is there a way to get handle on both the magnitude and phase plot?
Shoaibur Rahman
Shoaibur Rahman 2015년 2월 26일
Instead of bode , use bodeplot function, and then set properties using getoptions and setoptions functions.
h = bodeplot(tf1,'b',tf2,'r');
p = getoptions(h);
p.Ticklabel.FontSize = 20;
p.Ticklabel.Color = 'k';
setoptions(h,p)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by