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!