Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MATLAB: Changing the font of of XTickLabel, YTickLabel, etc

Tags:

matlab

In MATLAB one can change the font name of things such as ylabel, xlabel, title, etc. of a plot, e.g.

ylabel(y_string, 'FontName', 'Palatino')

However, is it possible to change the font of the XTicks, YTicks, etc?

like image 948
Amelio Vazquez-Reina Avatar asked Dec 16 '22 00:12

Amelio Vazquez-Reina


2 Answers

I've had fights with tick fonts before. I think they generally use the axes font, in which case something like:

set(gca, 'FontName', 'Palatino');

should work. If this is unsuccessful, you could try Format Tick Labels from the file exchange. It replaces the ticks with text objects, so the formatting can be completely customised as with any text object (I seem to remember having a look at it a while ago; you might need to hack around in the code to choose the font).

like image 188
Richante Avatar answered Dec 26 '22 10:12

Richante


set(gca,'XTickLabel',{labelList}, 'FontSize',8,'FontName','Times')
like image 21
zgormez Avatar answered Dec 26 '22 10:12

zgormez