How to hide the axes in front of 3D plots
Mostrar comentarios más antiguos
Hello,
I am doing a 3D plot and always have this annoying axes in front of my data (see image). How can I hide the front part of the axes? Just couldn't find it... Also I would be interested to change the spacing between the single graphs in the waterfall plot. Any idea?
Thank you!

1 comentario
Respuesta aceptada
Más respuestas (2)
Orion
el 5 de Nov. de 2014
Did you use the waterfall function or plot3 (you mentionned single graph)
in all cases, if you want to play with the spacing you need to modify your yaxis data.
ex1 : plot3
clear
figure;
subplot(121);
x=(0:0.01:10)';
for i = 1:10
y(:,i) = i*ones(size(x));
z(:,i) = i*abs(sin(x));
end
grid;
plot3(x,y,z);
% 2nd figure : spacing .5 along y
subplot(122);
y(:,1:5) = .5*y(:,1:5); % divide y by 2
y(:,6:10) = 2*y(:,6:10); % divide y by 2
plot3(x,y,z);
ex2 : waterfall
figure
subplot(121);
[X,Y,Z] = peaks(20);
waterfall(X,Y,Z);
subplot(122);
Y(1:10,:) = .2 * Y(1:10,:);
Y(11:20,:) = 3 * Y(11:20,:);
waterfall(X,Y,Z);
3 comentarios
Christine
el 5 de Nov. de 2014
Orion
el 5 de Nov. de 2014
ok, so you want to use the dataAspectRatio
[X,Y,Z] = peaks(20);
figure
subplot(121);
waterfall(X,Y,Z);
set(gca,'DataAspectRatio',[1 1 2])
subplot(122);
waterfall(X,Y,Z);
set(gca,'DataAspectRatio',[.5 1 2]);
Christine
el 6 de Nov. de 2014
Mike Garrity
el 5 de Nov. de 2014
FYI, R2014b added a new BoxStyle property to the axes which controls whether you see those front edges. The default value is 'back', which does exactly what you want here.
To get the old behavior in R2014b, you would do this:
set(gca,'BoxStyle','full')
Regardless of your BoxStyle, the box command will toggle the visibility of the box.
1 comentario
Christine
el 6 de Nov. de 2014
Categorías
Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!