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 CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by