How to Italicize either of the axis tick labels ?
157 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I need to italicize either xtick labels or ytick labels. I am using FontAngle command but it is changing both of them to italic. I need to change only one of the axes tick labels to italic. Suppose if I need to make the ytick label italic the xtick label should remain plain, but the the use of 'FontAngle' command changing the whole texts of the plots to italic. can anyone help me in this regard.
0 Commenti
Risposta accettata
VBBV
il 16 Mag 2023
Modificato: VBBV
il 16 Mag 2023
Use '\it label text'
% italic font
xticklabels({'\it text1','\it text2'})
% normal (plain) font
xticklabels({'text1','text2'})
Più risposte (1)
Steven Lord
il 16 Mag 2023
h = plot(1:10, 1:10);
xlabel('abracadabra')
ylabel('hocus pocus')
ax = ancestor(h, 'axes');
The XAxis and YAxis properties of the axes allow you to adjust properties of the X and Y axes independently. Let's make the X axis text italicized and the Y axis text in a larger font.
xaxisobj = ax.XAxis;
xaxisobj.FontAngle = 'italic';
yaxisobj = ax.YAxis;
yaxisobj.FontSize = 20;
See the description of the XAxis, YAxis, and ZAxis properties in the Rulers section of the documentation page for axes properties for more information.
0 Commenti
Vedere anche
Categorie
Scopri di più su Labels and Annotations 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!