Borrar filtros
Borrar filtros

Changing the axis property of matlab

2 visualizaciones (últimos 30 días)
Ede gerlderlands
Ede gerlderlands el 18 de Feb. de 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

Respuesta aceptada

José-Luis
José-Luis el 18 de Feb. de 2013
Editada: José-Luis el 18 de Feb. de 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 comentarios
José-Luis
José-Luis el 18 de Feb. de 2013
Please see edited answer.
Ede gerlderlands
Ede gerlderlands el 18 de Feb. de 2013
Thank you..

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by