简介
peaks;
axis tight%Set the axis limits to equal the range of the data
axis square
axis 'auto x'%x轴坐标上下限自动调整
axis off%Plot a surface without displaying the axes lines and background.
set(gca,'Visible','off'); %消除坐标轴,显示范围的大小没有改变,同上句
tmp = gca;
tmp.XAxis.Visible = 'off'; %隐藏X轴的
%上面一句也可以隐藏Ticks,同时Box的上端也隐藏了,这就使得图像看上去不太好看
tmp.XTick= []; %这一句可以只隐藏Ticks
%更多特性可参考Matlab帮助文档,查找"Axes Properties"
%例一:同时设置subplot的多幅图像的axis
% Create a figure with two subplots.set the axis limits for the subplots to the same values.
x1 = linspace(0,10,100);y1 = sin(x1);
ax1 = subplot(2,1,1);plot(ax1,x1,y1)
%
x2 = linspace(0,5,100);y2 = sin(x2);
ax2 = subplot(2,1,2);plot(ax2,x2,y2);
%
axis