4
votes

Is there a way to set very specific default properties for figure fonts and discriminate between tick font size, label font size, title font size, etc.. ?

I know I can set the default figure font properties by

set(0, 'DefaultAxesFontSize',14)
set(0, 'DefaultAxesFontWeight','bold')

But I'm looking for something like:

set(0, 'DefaultXTickLabelFontSize',10)
set(0, 'DefaultLegendFontSize',12)
% etc..

That would be very convenient. Thanks for any help!

1
I found out that my approach was correct, but XTickLabel doesn't seem to be an object type, that's why it wasn't working. - Lisa
Luis, thanks for the hint. I had already been on that site but implemented it the wrong way initially. - Lisa
@Lisa - could you please post your solution (as an answer to yourself) and accept it, so that this question doesn't appear as unanswered anymore? - Dev-iL

1 Answers

1
votes
clear all
close all

X=rand(10,1);
Y=rand(10,1);

figure(1)
plot(X,Y)
title('This is a figure','interpreter','latex','FontSize',30);
whitebg([1,0.89063,0.87891]) % Background
set(gca,'FontSize',21); % Font size
set(gca,'YTick',[0 0.2 0.4 0.6 0.8 1])
set(gca,'XTick',[0 0.2 0.4 0.6 0.8 1])
set(gca,'XColor',[0.38,0.10,0.10]) %Color of the axis X
set(gca,'YColor',[0.38,0.10,0.10]) %Color of the axis Y
xlabel('x','interpreter','latex','FontSize',30); % Using for instance latex fonts
ylabel('y','interpreter','latex','FontSize',30);
set(gca,'LineWidth',3)

Update:

To be default use something like this set(gca,'XTickLabelMode','auto'), set(gca,'XTickMode','auto')

Explanation: How to reset XTickLabel to default