axis in a plot in matlab

2 ビュー (過去 30 日間)
Rica
Rica 2013 年 2 月 20 日
Hi together
I have a plot. the x-axis is from 2:200. I want to show in the figure that x-axis is from 100:288. i know i could change it interactively, but i want to know if there is command to do this?
thank yyou

採用された回答

Walter Roberson
Walter Roberson 2013 年 2 月 20 日
The easiest way is to add the offset to your x data when you plot. For example, instead of
plot(x,y)
use
plot(x+98, y)
but if that is not practical, the next best way is something like:
for h = findobj(gca, '-property, 'XData')
set(h, 'Xdata', 98 + get(h, 'Xdata'));
end
There are also ways that involve leaving the data lone and instead changing the label on the x axis so it looks like it is going 100:298. This method can be effective in stubborn circumstances, but it Does Not Play Well with zooming or datacursor.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by