Reputation: 2127
I'm trying to plot a 3D surface in Matlab and I want to "compress" the plot a little bit in the z dimension. Now the lengths of x, y and z axes are the same, and the plot looks like a cube. I'd like it to look flatter in the z dimension, without altering the axes limits.
Is there any easy way to achieve this?
Upvotes: 3
Views: 1097
Reputation: 32930
Try fiddling with the DataAspectRatio
and the PlotBoxAspectRatio
properties of the axes, which may also be controlled by the pbaspect
and daspect
commands, correspondingly.
%// Plot surface
[X, Y] = meshgrid(-10:.1:10, -10:.1:10);
Z = 100 - X .^ 2 - Y .^ 2;
surf(X, Y, Z, 'EdgeColor', 'None')
%// Flatten the z-axis a bit
pbaspect([1 1 .2])
daspect([1 1 50])
Original plot:
Flattened plot:
Upvotes: 3