Changing the axis property of matlab

조회 수: 1 (최근 30일)
Ede gerlderlands
Ede gerlderlands 2013년 2월 18일
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

채택된 답변

José-Luis
José-Luis 2013년 2월 18일
편집: José-Luis 2013년 2월 18일
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
José-Luis
José-Luis 2013년 2월 18일
Please see edited answer.
Ede gerlderlands
Ede gerlderlands 2013년 2월 18일
Thank you..

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by