필터 지우기
필터 지우기

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 CenterFile Exchange에서 Specifying 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