1. 程式人生 > >matlab中axes用法

matlab中axes用法

%建立axes座標圖
h = axes();
%定義圖形位置和大小,[left bottom width height]
%set(h,'Position',[0.1 0.1 0.8 0.8]);
%畫圖
x=0:0.01:12;
y=sin(x);
plot(h,sin(x));
%Sets the location of the tick marks along the axis
set(h,'XTickLabel',[0;2;4;6;8;10;12;14]);
%顯示方格
set(h,'XGrid','on','YGrid','on');
%設定顏色、字型等屬性
set(h,'XColor',[0 0 0.7],...
       'YColor',[0 0 0.7],...
       'ZColor',[0 0 0.7],...
       'Color',[.9 .9 .9],...
       'GridLineStyle','--',...
       'ZTickLabel','-1|Z = 0 Plane|+1',...
       'FontName','times',...
       'FontAngle','italic',...
       'FontSize',14);
%定義X座標和Y座標的標籤名
set(get(h,'XLabel'),'String','Values of X',...
                    'FontName','times',...
                    'FontAngle','italic',...
                    'FontSize',14);
set(get(h,'YLabel'),'String','Values of Y',...
                    'FontName','times',...
                    'FontAngle','italic',...
                    'FontSize',14)
%定義圖形標題名                
set(get(h,'Title'),'String','/fontname{times}/ity=sin(x)',...
                    'FontName','times',...
                    'Color',[0 0 0.7],...
                    'FontSize',14);