axis in a plot in matlab

2 次查看(过去 30 天)
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