Why does the circle drawn in MATLAB look like an ellipse?

Interestingly, in MATLAB I would build a circle and show it correctly, and not by default, showing it as an ellipse. I assume this has something to do with the local coordinate system along the axis.

+3
source share
2 answers

You can use the command axis equalto set the data units to be the same on each axis. Here is 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;

enter image description here

+13
source

In addition to being used axis equalas @gnovice , you can disable the stretch function before filling with daspect :

daspect manual

or even to set the aspect ratio of the axes in explicit form:

daspect([1 1 1])
+5

Source: https://habr.com/ru/post/1724972/


All Articles