标签:
axis一般用来设置axes的样式,包括坐标轴范围,可读比例等
axis([xmin xmax ymin ymax])
axis([xmin xmax ymin ymax zmin zmax cmin cmax]) 坐标轴设置
v = axis
axis auto
axis manual
axis tight
axis fill
axis ij
axis xy
axis equal
axis image
axis square
axis vis3d
axis normal 坐标轴刻度比例等
axis off
axis on 显示与否
axis(axes_handles,...) 根据axes设置
[mode,visibility,direction] = axis(‘state‘) 返回当前axes属性
set(gca,‘xtick‘,[0:5:700]); %x的范围是0~700,每单位刻度长为5
set(gca,‘ytick‘,[0:2:650]); %x的范围是0~650,每单位刻度长为2
例子:
x=1:8;
subplot(2,2,1)
plot(x)%自动
subplot(2,2,2)
plot(x)
set(gca,‘xtick‘,[1 3 6 8]);%指定刻度点
set(gca,‘ytick‘,[]);%无刻度
subplot(2,2,3)
plot(x)
set(gca,‘xtick‘,[1 3 6 8]);
set(gca,‘xticklabel‘,sprintf(‘%03.4f|‘,get(gca,‘xtick‘)));%把x刻度打印成浮点数,4位小数位
set(gca,‘ytick‘,[2 4 5 7]);%y轴刻度位置
set(gca,‘yticklabel‘,{‘Two‘,‘Four‘,‘Five‘,‘Seven‘});%每一个刻度名称
subplot(2,2,4)
plot(x)
set(gca,‘xminortick‘,‘on‘);%副刻度线
set(gca,‘ticklength‘,[0.05 0.025]);%主副刻度线长度
set(gca,‘tickdir‘,‘out‘);%刻度方向向外
Day = {‘Sun‘,‘Mon‘,‘Tue‘,‘Wed‘,‘Thu‘,‘Fri‘,‘Sat‘};
plot(1:7,1:7);
set(gca,‘xticklabel‘,Day);
str=‘E:\directory\img_‘
x=[0:0.1:1];
xlab=[1:11];
for i=1:10
plot([0 1],[0 1]);hold on;plot([0 1],[1 2]);
set(gca,‘xtick‘,x);
set(gca,‘xticklabel‘,xlab);
hold off;
saveas(gcf,[str num2str(i) ‘.bmp‘]);%将当前plot的figure保存成bmp图像
end
x = 0:0.1:10;%x轴坐标
y = 0:0.1:10;%y轴坐标
[xx, yy] = meshgrid(x,y);%变成覆盖x-0-y区域的矩阵
zz = xx.^2 + yy.^2;%计算(x,y)处的函数值
figure
mesh(xx, yy, zz);
figure
surf(xx, yy, zz);
x:
xx:
zz:
mesh(xx, yy,zz) surf(xx, yy, zz)
标签:
原文地址:http://www.cnblogs.com/sunniflyer/p/3847415.html