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 Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by