How to begin axis from another value and make it a 0 point in plot matlab?
208 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have some measurements. On the x label they starts from 0 to 100, but from 23 I can see something change on the plot, so I want to show a plot from 23 to 100, and that is how i do this:
plot(x,y)
axis(23, 100, 0, 40)
let's say that y is from 0 to 40 and i don't want to change it.
But now I want to make 23 a 0, so then the 100 whould be 77- how can I make this?
Thanks
0 件のコメント
採用された回答
Benjamin Kraus
2018 年 3 月 5 日
If you want the ticks on your plot to show something other than the real numbers, you can either (a) change the numbers, or (b) manually specify your tick values.
To demonstrate, let me create some fake data:
x = 0:100;
fakedata = x/10;
fakedata(24:end) = sin(fakedata(24:end)-2.3)+2.3;
plot(x, fakedata)
Your two options are to either: change the X-values to something different (recommended):
plot(x-23, fakedata)
xlim([0 77])
Or manually specify your tick values:
plot(x,fakedata)
xlim([23 100]);
xticks(23:10:100);
xticklabels(0:10:77);
その他の回答 (3 件)
Jos (10584)
2018 年 3 月 5 日
1) change the limits
plot(x,y)
xlim([23 100])
2) change the data (not recommended)
plot(x,y-23)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Axis Labels についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!