Clear Filters
Clear Filters

How to hide the axes in front of 3D plots

4 views (last 30 days)
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 Comment
Christine
Christine on 6 Nov 2014
Edited: Christine on 6 Nov 2014
Thanks for the great answers! Each of them was really helpful. I would have liked to accept all of them :)

Sign in to comment.

Accepted Answer

Orion
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)
  1 Comment
Christine
Christine on 5 Nov 2014
Thanks! The 'box off' command takes off the whole box, so in order to still have a kind of box in the background, one has to set the axis limits to a grid line (-1 < radius < 1 and 0 < density < 2.5e19 in my example).
I see that a higher number of plotted profiles will cause the profiles to be closer to each other, as matlab keeps the z-axis (in my example) the same length. But how can I get the plots closer without increasing their number or changing the viewing angle? Is there a possibility to tell matlab to change the aspect ratio of the axes?

Sign in to comment.

More Answers (2)

Orion
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
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]);
Christine
Christine on 6 Nov 2014
Great! This is exactly what I was searching for!

Sign in to comment.


Mike Garrity
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.

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!