How can I use XTickLabel with a bigger font in a subplot
6 次查看(过去 30 天)
显示 更早的评论
Dear MatLab users,
I have a tiny graphic problem. I am using a subplot(1 , 2 , 1) and (1,2,2) type, and I would like my XTickLabel being in decimal and with a relatively large fontsize. However, in the example below, which uses the same format of the plot that I need, if I put the fontsize_axis equal or greater than 19, the command XTickLabel does not work anymore, meaning that it puts the label in the wrong order. However, there is enough space for the fontsize to be at least 22 and more. Is there a way to fix this or do it in another way? I can use " set(gca,'XLim',[0.001 1], 'XTick', 10.^(-3:0))" instead, but I do not want it in exponential notation.
a = 10*rand(1,5);
b = rand(1,5);
fontsize_axis = 19 ;
subplot(1 , 2 , 1)
semilogx(a,b)
axis([0.001 10 0 1])
set(gca ,'Fontsize', fontsize_axis ,'FontWeight','bold')
ax = gca ;
ax.XTickLabel={'0.001' , '0.01' , '0.1' ,'1' , '10'};
set(gcf , 'color','w' , 'WindowState' , 'Maximize')
0 个评论
采纳的回答
Jan
2021-3-17
Problems occur, if the number of XTicks differs from the number of XTickLabels. So set both:
a = 10*rand(1,5);
b = rand(1,5);
fontsize_axis = 19 ;
subplot(1 , 2 , 1)
semilogx(a,b)
axis([0.001 10 0 1])
set(gca ,'Fontsize', fontsize_axis ,'FontWeight','bold', ...
'XTickLabel', {'0.001' , '0.01' , '0.1' ,'1' , '10'}, ...
'XTick', [0.001, 0.01, 0.1, 1, 10]);
set(gcf , 'color','w' , 'WindowState' , 'Maximize')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!