您可以將'FontUnits','points'
添加到set
函數。取決於你如何保存圖,你可以使用print
而不是,保存爲函數。
下面是我用於打印我的數字的腳本。它是基於this:
filename = 'myfile'; % figure to be printed
uiopen(myfile,1)
axis([0 200 -0.1 0.15]) % scale the axis
set(gca,...
'Units','normalized',...
'YTick',-0.1:0.05:0.15,...
'XTick',0:50:200,...
'Position',[.15 .2 .75 .7],...
'FontUnits','points',...
'FontWeight','normal',...
'FontSize',9,...
'FontName','Times')
ylabel({'f(x)'},... % {} allows to add Latex code in the label
'FontUnits','points',...
'interpreter','latex',...
'FontSize',14,...
'FontName','Times')
xlabel({'$x$'},...
'FontUnits','points',...
'interpreter','latex',...
'FontWeight','normal',...
'FontSize',14,...
'FontName','Times')
legend({'$f(x) = x$'},...
'FontUnits','points',...
'interpreter','latex',...
'FontSize',14,...
'FontName','Times',...
'Location','NorthEast')
title({'This is: $f(x) = x$'},...
'FontUnits','points',...
'interpreter','latex',...
'FontWeight','normal',...
'FontSize',14,...
'FontName','Times')
title('This is: $f(x) = x$')
legend('$f(x) = x$')
print(filename,'-depsc2'); % print to filename.eps
我會建議使用['export_fig'](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved = 0ahUKEwic-OiT0OPQAhXDiFQKHbzDCnsQFggcMAA&url = https%3A%2F%2Fwww.mathworks.com%2Fmatlabcentral%2Ffileexchange%2F23629-export-fig&usg = AFQjCNEDN_TlqJVumTNSQksz6ctIDKISZQ&sig2 = stAUqbP87o4JLas0TQJi7Q) – Suever