[英]Why does a circle plotted in MATLAB appear as an ellipse?
I wonder in MATLAB how I would plot a circle and show it correctly instead of by default showing it as an ellipse. 我想知道在MATLAB中我将如何绘制圆圈并正确显示它而不是默认显示为椭圆形。 I guess it has something to do with the local coordinate system in the axis. 我想这与轴上的局部坐标系有关。
You can use the command axis equal
to set the data units to be the same on each axis. 您可以使用命令axis equal
在每个轴上将数据单位设置为相同。 Here's an example: 这是一个例子:
theta = linspace(0, 2*pi, 100);
subplot(121); % Show the default plot
plot(cos(theta), sin(theta));
title('Default axes settings');
subplot(122); % Show a plot with equal data units
plot(cos(theta), sin(theta));
title('Equalized tick spacing');
axis equal;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.