2014-02-14 12 views
4

有沒有一種方法可以爲圖形字體設置非常具體的默認屬性,並區分刻度字體大小,標籤字體大小,標題字體大小等。MATLAB設置特定的默認圖形屬性

我知道我可以通過

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

設置默認的數字字體屬性,但我在尋找類似:

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

這將是非常方便的。謝謝你的幫助!

+1

[This information](http://www.mathworks.es/es/help/matlab/creating_plots/setting-default-property-values.html#brb8fc3)可能有幫助 –

+0

我發現我的方法是正確,但XTickLabel似乎不是一個對象類型,這就是爲什麼它不起作用。 – Lisa

+0

路易斯,感謝您的提示。我已經在那個網站上,但最初是以錯誤的方式實施的。 – Lisa

回答

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', '汽車'),集(GCA, 'XTickMode', '汽車')

說明:How to reset XTickLabel to default

+0

也許你可以包括一個人物來惡魔呢? – kkuilla

+0

尊敬的@kkuilla我誤解了這個問題。請看現在。 Daniel – DanielTheRocketMan

+0

親愛的@Lisa我誤解了這個問題。請看現在。 – DanielTheRocketMan