Thanks for the great answers! Each of them was really helpful. I would have liked to accept all of them :)
How to hide the axes in front of 3D plots
4 views (last 30 days)
Show older comments
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!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/145983/image.png)
Accepted Answer
Orion
on 5 Nov 2014
Hi,
So to remove the annoying box :
box off
and for the spacing, it depends of the definition of your Z data. the more Z is meshed, the more waterfall will plot lines.
with the matlab example : f
igure
[X,Y,Z] = peaks(30);
waterfall(X,Y,Z)
figure
[X,Y,Z] = peaks(90);
waterfall(X,Y,Z)
More Answers (2)
Orion
on 5 Nov 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 Comments
Orion
on 5 Nov 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]);
Mike Garrity
on 5 Nov 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.
See Also
Categories
Find more on Graphics Object Properties in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!