axis in a plot in matlab
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponse acceptée
Walter Roberson
le 20 Fév 2013
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!