How can I use XTickLabel with a bigger font in a subplot
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Gianluca Regina
il 17 Mar 2021
Commentato: Gianluca Regina
il 17 Mar 2021
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 Commenti
Risposta accettata
Jan
il 17 Mar 2021
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')
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Subplots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!