フィルターのクリア

change axis range but not the graph in 3d plot

1 回表示 (過去 30 日間)
Florian
Florian 2012 年 9 月 17 日
Hello all,
Please try this
GG2 =rand(109,512);
figure43 = figure(43);
surf(GG2)
figure44 = figure(44);
x = linspace (20,200,2);
surf(x,GG2(:,1),GG2);
I do want the same graph than in figure43 but the x-axis range should go from 20 to 200 and not from 0 to 600.
The figure44 shows nothing...
Is this possible somehow?
Regards,

回答 (1 件)

José-Luis
José-Luis 2012 年 9 月 17 日
Is it not just a matter of setting the axes limits to [0 200]?
GG2 =rand(109,512);
figure43 = figure(43);
h = surf(GG2)
aH = ancestor(h,'axes')
set(aH,'XLim',[20 200])
  2 件のコメント
Florian
Florian 2012 年 9 月 17 日
編集済み: Florian 2012 年 9 月 17 日
I am afraid not because xlim([20 200]) just cuts off the rest of the graph. I want the whole graph displayed just like before but with another axis range (20-200)
José-Luis
José-Luis 2012 年 9 月 17 日
編集済み: José-Luis 2012 年 9 月 18 日
The easiest way would be to set the ticks to the range 20-200 instead, for example:
set(aH,'XTick',20:20:200)
If you want the axes to go only from 20 to 200, then it is not trivial. You could copy the axes and make the original axes invisible ('Visible','off') and set the position of the new axes so they correspond to [20 200]. The difficulty of that approach is that the axes position is defined with respect to the figure box, not to the plot coordinates. You would need to transform between one and the other, i.e. if you rotate your plot you would need to recalculate everything.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by