在x轴上左/右移除空间

时间:2013-11-05 10:14:11

标签: matlab

如何删除x轴上的左/右空格。

hold all
set(gcf,'color','w')
L1=min(ndata_(:,1));
L2=max(ndata_(:,1));
plot(ndata_(:,1),ndata_(:,2))

NumTicks = 20;
L = get(gca,'XLim');
set(gca,'XTick',linspace(L1,L2,NumTicks))
datetick('x',13,'keeplimits', 'keepticks')
xticklabel_rotate;
set(gca,'XMinorTick','on','YMinorTick','on')
ylim([-0.2 .2])
grid on
hold off

enter image description here

ndata_=[41582.3596295486    0.0154999999999995
41582.3596300926    0.0154999999999995
41582.3596306366    0.0154999999999995
41582.3596313657    0.0154999999999995
41582.3596319097    0.0154999999999995
41582.3596324421    0.0154999999999995
41582.3596329861    0.0154999999999995
41582.3596335301    0.0154999999999995
41582.3596340625    0.0154999999999995
41582.3596346065    0.0154999999999995
41582.3596351505    0.0154999999999995
41582.3596356829    0.0154999999999995
41582.3596362269    0.0154999999999995
41582.3596367708    0.0154999999999995
41582.3596373032    0.0154999999999995
41582.3596378472    0.0154999999999995
41582.3596383912    0.0154999999999995
41582.3596389236    0.0154999999999995
41582.3596394676    0.0154999999999995
41582.3596400116    0.0154999999999995
41582.3596405440    0.0154999999999995
41582.3596410880    0.0154999999999995
41582.3596416319    0.0154999999999995
41582.3596423611    0.0154999999999995
41582.3596429051    0.0154999999999995
41582.3596434375    0.0154999999999995
41582.3596439815    0.0154999999999995
41582.3596445255    0.0154999999999995
41582.3596450579    0.0154999999999995
41582.3596457986    0.0154999999999995
41582.3596463310    0.0154999999999995
41582.3596468750    0.0154999999999995
41582.3596474190    0.0154999999999995
41582.3596479514    0.0154999999999995
41582.3596484954    0.0154999999999995
41582.3596490394    0.0154999999999995
41582.3596495718    0.0154999999999995
41582.3596501157    0.0154999999999995
41582.3596506597    0.0154999999999995
41582.3596512384    0.0154999999999995
41582.3596517708    0.0154999999999995
41582.3596522801    0.0154999999999995
41582.3596528588    0.0154999999999995
41582.3596535532    0.0154999999999995
41582.3596540856    0.0154999999999995
41582.3596546296    0.0154999999999995
41582.3596551736    0.0154999999999995
41582.3596557523    0.0154999999999995
41582.3596562847    0.0154999999999995
41582.3596567940    0.0154999999999995
41582.3596573727    0.0194999999999995
41582.3596579051    0.0194999999999995
41582.3596585995    0.0194999999999995
41582.3596591435    0.0194999999999995
41582.3596596875    0.0194999999999995
41582.3596606134    0.0194999999999995
41582.3596611458    0.0194999999999995
41582.3596618866    0.0194999999999995
41582.3596624190    0.0194999999999995
41582.3596629630    0.0194999999999995
41582.3596635070    0.0194999999999995
41582.3596640394    0.0194999999999995
41582.3596645833    0.0194999999999995
41582.3596651273    0.0194999999999995
41582.3596656597    0.0194999999999995
41582.3596662037    0.0194999999999995
41582.3596667477    0.0194999999999995
41582.3596672801    0.0194999999999995
41582.3596678241    0.0194999999999995
41582.3596683681    0.0194999999999995
41582.3596689005    0.0194999999999995
41582.3596694444    0.0194999999999995
41582.3596699884    0.0194999999999995
41582.3596705208    0.0194999999999995
41582.3596712616    0.0194999999999995
41582.3596719907    0.0194999999999995
41582.3596725347    0.0194999999999995
41582.3596730671    0.0194999999999995
41582.3596736111    0.0194999999999995
41582.3596741551    0.0194999999999995
41582.3596746875    0.0194999999999995
41582.3596752315    0.0194999999999995
41582.3596757755    0.0194999999999995
41582.3596766551    0.0194999999999995
41582.3596771991    0.0194999999999995
41582.3596777431    0.0194999999999995
41582.3596783218    0.0194999999999995
41582.3596788542    0.0194999999999995
41582.3596793634    0.0194999999999995
41582.3596799421    0.0194999999999995
41582.3596804745    0.0194999999999995
41582.3596810185    0.0194999999999995
41582.3596815625    0.0194999999999995
41582.3596820949    0.0194999999999995
41582.3596826389    0.0194999999999995
41582.3596831829    0.0194999999999995
41582.3596837153    0.0194999999999995
41582.3596844560    0.0194999999999995
41582.3596849884    0.0194999999999995
41582.3596855324    0.0194999999999995


]

从文件交换中下载xticklabelrotation。

1 个答案:

答案 0 :(得分:2)

使用axis命令

>> axis( [ min(ndata(:,1)), max(ndata(:,1)),-.2 .2 ] )

或者,您可以使用xlim

>> xlim( [ min(ndata(:,1)), max(ndata(:,1))] );