How to change the font size of xtick and ytick with scientific notation on the side?
Show older comments
xticklabel_fs = get(gca,'XTickLabel');
set(gca, 'XTickLabel', xticklabel_fs, 'FontName', 'Times New Roman', 'fontsize', 12);
yticklabel_fs = get(gca,'YTickLabel');
set(gca, 'YTickLabel', yticklabel_fs, 'FontName', 'Times New Roman', 'fontsize', 12);
Origin:

After applying the above code:

Can anyone tell me what to do with it?
After applying the above code, the font size is enlarged but the scientific notation disappear?
Accepted Answer
More Answers (1)
Walter Roberson
on 10 Aug 2022
0 votes
Scientific notation is always disabled when you supply your own tick labels. Scientific notation is only for automatic labeling.
2 Comments
haohaoxuexi1
on 10 Aug 2022
dpb
on 10 Aug 2022
Good point, Walter. I'd not thought about that nuance in writing tick labels that disconnects them from the tick values also triggering the change in formatting; just knew it wasn't needed for what OP wanted.
Categories
Find more on Axis Labels 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!