Borrar filtros
Borrar filtros

change axis range but not the graph in 3d plot

1 visualización (últimos 30 días)
Florian
Florian el 17 de Sept. de 2012
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,

Respuestas (1)

José-Luis
José-Luis el 17 de Sept. de 2012
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 comentarios
Florian
Florian el 17 de Sept. de 2012
Editada: Florian el 17 de Sept. de 2012
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 el 17 de Sept. de 2012
Editada: José-Luis el 18 de Sept. de 2012
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Specifying Target for Graphics Output en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by