Filter löschen
Filter löschen

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

5 Ansichten (letzte 30 Tage)
ercan duzgun
ercan duzgun am 25 Feb. 2022
Kommentiert: Voss am 25 Feb. 2022
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.

Akzeptierte Antwort

Voss
Voss am 25 Feb. 2022
Bearbeitet: Voss am 25 Feb. 2022
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 Kommentare
ercan duzgun
ercan duzgun am 25 Feb. 2022
@_ Thank you very much.
Voss
Voss am 25 Feb. 2022
@ercan duzgun You're welcome!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by