フィルターのクリア

xtick label font change affect ytick label font

67 ビュー (過去 30 日間)
Jeyoung Kim
Jeyoung Kim 2023 年 9 月 19 日
編集済み: Dyuman Joshi 2023 年 9 月 21 日
I tried to increase xtick font size.
But, it also increased ytick font size.
How do I control them independently?
ax4=subplot(4,1,4);
plot(x,Mode1_AFR,'-o',Color='k',LineWidth=1,MarkerFaceColor=[0 0 0]);
hold on;
plot(x,Mode2_AFR,'-^',Color='g',LineWidth=1,MarkerFaceColor=[0 1 0]);
hold on;
plot(x,Mode3_AFR,'-squar',Color='r',LineWidth=1, MarkerFaceColor=[1 0 0],MarkerSize=9);
xpos = -89 % (find this out from get(yl,'pos') on the desired label x-location)
yl=ylabel('AFR [--]',FontSize=12)
pos=get(yl,'Pos')
set(yl,'Pos',[xpos pos(2)+5 pos(3)])
grid on
xlim([-80 80]);
ylim([10 50]);
yticks(10:10:50);
myaxis=gca;
myaxis.XTickLabel= { } ;
yline(0);
str={'','v3','v2','v1','0','v1','v2','v3',''};
xticklabels(str);
a = get(gca,'XTickLabel');
set(gca,'XTickLabel',a,'fontsize',10)
xlabel({'(d)','Boost pressure sweep'},FontSize=12)

回答 (2 件)

Dyuman Joshi
Dyuman Joshi 2023 年 9 月 19 日
編集済み: Dyuman Joshi 2023 年 9 月 19 日
"How do I control them independently?"
There is no particular quantity 'Tick Label Font size' you can change, however you can change (all) the text sizes of X axis and Y axis separately (that includes labels for axis and other properties as well).
x = 0:0.01:10;
y = sin(x);
figure
plot(x,y)
ax = gca;
xlabel('x')
ylabel('sin(x)')
ax.XAxis.FontSize = 10;
ax.YAxis.FontSize = 15;
  2 件のコメント
Jeyoung Kim
Jeyoung Kim 2023 年 9 月 20 日
Well, I want to change label and labeltick with different font size....
Dyuman Joshi
Dyuman Joshi 2023 年 9 月 20 日
編集済み: Dyuman Joshi 2023 年 9 月 21 日
"Well, I want to change label and labeltick with different font size...."
Then you can use text instead of ylabel to make the label and change the font sizes the text and tick-labels separately.

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


Steven Lord
Steven Lord 2023 年 9 月 19 日
Changing the FontSize property of an axes does affect the font size of both the X and Y rulers. If you get the ruler you want to change from the axes you can change properties of that ruler that won't affect the properties of other rulers.
plot(1:10);
ax = gca;
% Get the X and Y rulers to modify their properties independently
X = ax.XAxis;
Y = ax.YAxis;
% Make the X axis (but not the Y axis) red
X.Color = 'r';
% Increase the font size of the Y axis (but not the X axis)
Y.FontSize = 2*Y.FontSize;
% Change the tick direction for both X and Y axis using the axes property
ax.TickDir = 'both';
See the description of the XAxis, YAxis, and ZAxis Rulers properties in the documentation for more information about how to work with the ruler objects.

カテゴリ

Help Center および File ExchangeLabels and Annotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by