axis函數可以用於操作普通的坐標屬性(軸的縮放和外觀)。
比如:
axis( [xmin xmax ymin ymax] ):可以設置當前坐標軸 x軸 和 y軸的限制範圍
axis( [xmin xmax ymin ymax zmin zmax cmin cmax] ) 可以設置 x,y,z軸的限制範圍和色差範圍。
v = axis 返回壹個行向量,記錄了坐標範圍
axis auto 解除限制,恢復到默認狀態。
舉例說明:
畫壹個tan函數從0到2π。
>> x=0:0.01:pi/2;
>> y=tan(x);
>> figure
>> plot(x,y,'-o')
>> axis([0,pi/2,0,5]) % 改變坐標軸範圍
>> v = axis % 返回坐標軸的範圍
v = 0 1.5708 ?0 5.0000
擴展資料
axis實現圖形坐標控制
clear all;
close all;
clc;
t =0:2*pi/99:2*pi;?
x =1.5*cos(t);
y =3.25*sin(t);
subplot(2,3,1),plot(x,y);
axis normal,grid on, title('Normal and Grid on')?
subplot(2,3,2),plot(x,y);
axis equal,grid on, title('Equal and Grid on')?
subplot(2,3,3),plot(x,y);
axis square,grid on, title('Square and Grid on')
subplot(2,3,4),plot(x,y);
axis image,box off,title('Image and Box off')
subplot(2,3,5),plot(x,y);
axis image fill,box off, title('Image fill and box off')
subplot(2,3,6),plot(x,y);
axis tight,box off, title('Tight and box off'
參考資料: