本帖最后由 happy 于 2010-10-25 07:02 编辑
刻度离坐标轴的距离是通过
- % ADD LABELS
- text(X,zeros(size(X))-2.*Yoff,XL);
- text(zeros(size(Y))-3.*Xoff,Y,YL);
复制代码 控制的,比如修改为:
- % ADD LABELS
- text(X,zeros(size(X))-2.*Yoff*0.7,XL);
- text(zeros(size(Y))-3.*Xoff*0.7,Y,YL);
复制代码 至于标签的控制可以通过如下方式实现,例如:
- clc;
- clear;
- plot([0,1],[0,1],'b:');
- hold on;
- x=rand(50,2);
- x=[x;-0.2*rand(1),0.2*rand(1)];
- z=abs(x(:,1)-x(:,2));
- plot(x(find(z<0.1),1),x(find(z<0.1),2),'.','MarkerSize',20,'MarkerEdgeColor','m','MarkerFaceColor','m');
- plot(x(find(z>=0.1),1),x(find(z>=0.1),2),'.','MarkerSize',20,'MarkerEdgeColor','b','MarkerFaceColor','b');
- set(gca,'XTick',-0.2:0.2:1.0)
- set(gca,'XTickLabel',{'-0.2','0.0','0.2','0.4','0.6','0.8','1.0'});
- set(gca,'YTick',0.2:0.2:1.0)
- set(gca,'YTickLabel',{'0.2','0.4','0.6','0.8','1.0'})
- PlotAxisAtOrigin(0,0)
复制代码
效果图如下:
|