[英]X axis scaling with matlab plotting
我的数据稀疏,因此当我绘制图表时,我得到以下结果
如您所见,第一个x轴刻度从500(s)开始,但我的大部分数据都是30(s)左右。 我可以更改x轴的缩放比例吗?
这个怎么样?
X = [1 3 6 10 25 30 235 678 1248];
Y = [0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.8 0.9];
plot(X,Y,'-b.')
figure
semilogx(X,Y,'-b.')
我看到以下输出:
如果要显示0到30秒的数据,只能绘制以下内容:
idcs=Xdata <30; %# find indices where X is less than 30s
plot(Xdata(idcs),Ydata(idcs),'b'); %#plot only these data.
或者你可以在图上表达XLim
。
plot(Xdata,Ydata,'b'); %# plot everything
set(gca,XLim,[0 30]); %# limit display on X axis
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.