[英]X axis scaling with matlab plotting
My data is sparse therefore when I plot my graph I get the following result 我的数据稀疏,因此当我绘制图表时,我得到以下结果
As you can see the first x axis tick starts at 500(s), but most of my data is around 30(s). 如您所见,第一个x轴刻度从500(s)开始,但我的大部分数据都是30(s)左右。 Can I change the scaling of the x axis? 我可以更改x轴的缩放比例吗?
How about this? 这个怎么样?
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.')
I see the following output: 我看到以下输出:
If you want to display data from 0 to 30s only you can either plot only those like this: 如果要显示0到30秒的数据,只能绘制以下内容:
idcs=Xdata <30; %# find indices where X is less than 30s
plot(Xdata(idcs),Ydata(idcs),'b'); %#plot only these data.
or you can just express XLim
its on the figure. 或者你可以在图上表达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.