How to Italicize either of the axis tick labels ?
157 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
More Answers (1)
Steven Lord
on 16 May 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 Comments
See Also
Categories
Find more on Labels and Annotations 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!