Effacer les filtres
Effacer les filtres

Changing the axis property of matlab

1 vue (au cours des 30 derniers jours)
Ede gerlderlands
Ede gerlderlands le 18 Fév 2013
I have the already plotted matlab figure and I want to change the x-axis value of the plot. I intend to multiply the old x -value by 1000 to get the new x which has to be shown in graph.
Can somebody help me with that?
Thanks

Réponse acceptée

José-Luis
José-Luis le 18 Fév 2013
Modifié(e) : José-Luis le 18 Fév 2013
h = plot(rand(10,1));
aH = ancestor(h,'axes');
x = get(h,'XData');
new_x = x .* 1000;
new_y = get(h,'Ydata');
delete(h);
plot(aH,new_x,new_y);
Alternatively, you could only change the XTickLabel:
h = plot(rand(10,1));
aH = ancestor(h,'axes');
x = get(aH,'XTick');
set(aH,'XTickLabel',sprintf('%d |',x.*1000));
  3 commentaires
José-Luis
José-Luis le 18 Fév 2013
Please see edited answer.
Ede gerlderlands
Ede gerlderlands le 18 Fév 2013
Thank you..

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots 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!

Translated by