Changing only axis fontsize

조회 수: 5 (최근 30일)
Kevin Prieur
Kevin Prieur 2016년 11월 11일
댓글: Walter Roberson 2016년 11월 11일
Hi all,
I'm wrinting a function that I run just before exporting my figures in order to increase the fontsize of the axis TICKS labels (basically, numbers). I'm doing this as follows:
fig = gcf();
fig = get(fig,'Parent');
ax = findobj(fig,'type','axes', ...
'-not','Tag','legend','-not','Tag','Colorbar');
set(ax,'fontsize',13)
The problem here is that when I do that, it also changes the fontsize of my labels because they are included in my "ax" variable (I change them in my main.m).
How can I select only the and not also the labels created with xlabel, ylabel or supblabel ?
Thanks !
  댓글 수: 2
Md Alam
Md Alam 2016년 11월 11일
Little Addition to the question:
Can we change font of tick-labels of X and Y axis to LATEX? Just like axis labels.
Walter Roberson
Walter Roberson 2016년 11월 11일
With R2014b or later, the XAxis and YAxis rulers have a TickLabelInterpreter property. https://www.mathworks.com/help/matlab/ref/numericruler-properties.html

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2016년 11월 11일
As you are excluding legend and colorbar from your axes, we deduce that you are using R2014a or earlier; in R2014b and later, legend and colorbar are not axes.
With R2014a or earlier, there is only one font size property for axes.
In order to change the font size of only the labels, you need to use a technique similar to what is used in https://www.mathworks.com/matlabcentral/fileexchange/3486-xticklabel-rotate where the automatic labels are found and are replaced by text objects that have the desired properties.
If you were using R2014b or later, you could avoid all of that by setting the XAxis.Fontsize or YAxis.FontSize properties of the axes.
  댓글 수: 1
Kevin Prieur
Kevin Prieur 2016년 11월 11일
Thanks a lot for your answer.
I'm actually using Matlab 2016a. But I wrote my function under Matlab 2014a. That's why I'm noticing this problem just now.
I'll find my way with XAxis.Fontsize then, thanks !

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by