[英]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.