how to change the font size in a plot (only for the axes numbers) for double axis figure

조회 수: 32 (최근 30일)
I have a problem changing axis font size of a double axis figure (i.e., plotyy). the font size is only changed for one of the axis
it is possible to change the font size of a single axis figure using the command "set(gca,'fontsize',number), what about the double axis.

답변 (2개)

Voss
Voss 2023년 8월 4일
Rather than relying on gca(), you can use the two axes handles returned by plotyy, as in:
x = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
figure % new figure
ax = plotyy(x,y1,x,y2);
set(ax(1),'FontSize',6)
set(ax(2),'FontSize',16)

Daniel Bengtson
Daniel Bengtson 2023년 8월 4일
Save the axes handle when you create the plot rather than using gca.
[AX,h1,h2] = plotyy(1:10,rand(10,1),1:10,rand(10,1));
set(AX,'fontsize',20)

카테고리

Help CenterFile Exchange에서 Two y-axis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by