what 's different between axis square and axis equal in matlab ?
显示 更早的评论
when I plot or surf, what's different between axis square and axis equal ?
采纳的回答
更多回答(1 个)
Narin Deveci
2020-10-30
0 个投票
Do you know the formula to set your axes to be square?
5 个评论
Walter Roberson
2020-10-30
Could you explain your question further?
Narin Deveci
2020-10-30
well, I am making a barchart with the data I have, and it says 'set the axes to be square, and save a pdf copy of the figure names ‘PhaseAmpMod.pdf’. I dont fully understand it, so not sure I am explaining well.
Walter Roberson
2020-10-30
axis square
is the command.
Muhammad Safdar
2020-11-23
Hi, I have a 3D plot, I set axis([-100 100 -80 120 -50 150]) followed by axis equal. That means I have equal range of data in all directions and figure should look like a cube but hight looks larger than bottom witdhs on my screen? why?
Remember that a figure window, as created by default in MATLAB is not square. So even though you set the axis limits to have a distance of 200 from min to max on each axis, the result will not look like a cube, because each axis will then be scaled to fit into the rectangular box of the figure.
We can see this quite well using the function sphere. If I just call sphere, it will generate a nicely spherical shape, but it won't look like a sphere. Instead, you will see an oblate sphereoid.
sphere
Instead, if I set the axes to have equal units on each axis, (using the command "axis equal"), we will see the same thing, but now it will look sphereical.
figure
sphere
axis equal
Exactly the same thing happens when you tried to plot a cube. For example...
XYZ = rand(10000,3); % some data that lives inside the unit cube
Plotting the data in a set of default axes, it will not appear as if it lives in a cube.
plot3(XYZ(:,1),XYZ(:,2),XYZ(:,3),'.')
box on
But now, if I tell MATLAB this should live in a domain with equal scaling on the axes, we will see it as living inside a cubical domain.
figure
plot3(XYZ(:,1),XYZ(:,2),XYZ(:,3),'.')
axis equal
box on
类别
在 帮助中心 和 File Exchange 中查找有关 2-D and 3-D Plots 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



