How can I change axis font size only in a figure?

7 ビュー (過去 30 日間)
ercan duzgun
ercan duzgun 2022 年 2 月 25 日
コメント済み: Voss 2022 年 2 月 25 日
I would like to change only the axis font size in a figure. How can I do this?
My code is:
clear
clc
close all
x=linspace(0,4*pi,10)
y=x.^2.*sin(x);
f1=figure
f1.Units='centimeters'
f1.Position = [30 30 100 100]/10;
f1.Name='Measured Data'
hold on
plot(x,y,'m-','LineWidth',3)
plot(x,y,'m^','MarkerSize',14,'LineWidth',3)
xlabel('seconds','FontSize',15,...
'FontWeight','bold','Color','r')
ylabel('Population','FontSize',15,...
'FontWeight','normal','Color','r')
grid on
title('x vs. t, and example plot')
legend('y','y(data points)','Location','best')
axis([min(x) max(x) min(y) max(y)])
text(2,-40,'The angle of the wheel \theta')
Then the figure is
If I write
set(gca,'XLim',[min(x) max(x)],'FontSize',20)
command, then the figure becomes:
However I want to change only x axis and y axis font size. Not others to change. How can I don this?
Thanks in advance.

採用された回答

Voss
Voss 2022 年 2 月 25 日
編集済み: Voss 2022 年 2 月 25 日
clear
clc
close all
x=linspace(0,4*pi,10);
y=x.^2.*sin(x);
f1=figure;
f1.Units='centimeters';
f1.Position = [30 30 100 100]/10;
f1.Name='Measured Data';
hold on
plot(x,y,'m-','LineWidth',3)
plot(x,y,'m^','MarkerSize',14,'LineWidth',3)
xlabel('seconds','FontSize',15,...
'FontWeight','bold','Color','r')
ylabel('Population','FontSize',15,...
'FontWeight','normal','Color','r')
grid on
title('x vs. t, and example plot')
legend('y','y(data points)','Location','best')
axis([min(x) max(x) min(y) max(y)])
text(2,-40,'The angle of the wheel \theta')
set([get(gca(),'XAxis') get(gca(),'YAxis')],'FontSize',20);
  5 件のコメント
ercan duzgun
ercan duzgun 2022 年 2 月 25 日
@_ Thank you very much.
Voss
Voss 2022 年 2 月 25 日
@ercan duzgun You're welcome!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by