xtick label font change affect ytick label font
    21 views (last 30 days)
  
       Show older comments
    
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)

0 Comments
Answers (2)
  Dyuman Joshi
      
      
 on 19 Sep 2023
        
      Edited: Dyuman Joshi
      
      
 on 19 Sep 2023
  
      "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 Comments
  Dyuman Joshi
      
      
 on 20 Sep 2023
				
      Edited: Dyuman Joshi
      
      
 on 21 Sep 2023
  
			"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
    
      
 on 19 Sep 2023
        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.
0 Comments
See Also
Categories
				Find more on Axis Labels in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



