MATLAB: How can axes tick label color be changed

MATLAB

How can axes numerical tick label color be changed? One method seems to be to use 'axes.XAxis.Color' property but this changes more than the numerical value's color.

Best Answer

This can be done by altering the 'TickLabel' text for the axes, using TeX Markup:
plot(1:10)
ax=gca;
for ii=1:10
ax.XTickLabel{ii}=['\color[rgb]{1,0,0} ',num2str(ii)];
end
for ii=1:10
ax.YTickLabel{ii}=['\color[rgb]{1,0,0} ',num2str(ii)];
end
The above code sets the color of Y-Axes and X-Axes labels to red.