有没有办法为图形字体设置非常具体的默认属性,并区分刻度字体大小,标签字体大小,标题字体大小等。?
我知道我可以通过
设置默认的数字字体属性set(0, 'DefaultAxesFontSize',14)
set(0, 'DefaultAxesFontWeight','bold')
但我正在寻找类似的东西:
set(0, 'DefaultXTickLabelFontSize',10)
set(0, 'DefaultLegendFontSize',12)
% etc..
这将非常方便。谢谢你的帮助!
答案 0 :(得分:1)
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)
更新
默认使用类似此设置(gca,'XTickLabelMode','auto'),set(gca,'XTickMode','auto')