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

31 Ansichten (letzte 30 Tage)
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.

Antworten (2)

Voss
Voss am 4 Aug. 2023
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 am 4 Aug. 2023
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)

Kategorien

Mehr zu Two y-axis finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by