# how to make figure perfectly squared?

174 views (last 30 days)
MP on 24 Aug 2022
Commented: Walter Roberson on 24 Aug 2022
I would like to make a perfect squared figure. When I use axis equal I still find that y-axis is stretched more than x-axis and does not make a perfect square. It appears like a rectangle elongated in y-direction. I do not want to change x and y limits.
I understand that my PC screen does not have 1:1 ratio, but how to get figure in 1:1 ratio??
Here is the tentative code:
clear; close all; clc;
subplot(131)
plot((1:20),(5:5:100))
xlim([1,20]); ylim([5,100]);
axis normal;
axis square;
subplot(132)
plot((1:20),(5:5:100))
xlim([1,20]); ylim([5,100]);
axis normal;
axis square;
subplot(133)
plot((1:20),(5:5:100))
xlim([1,20]); ylim([5,100]);
axis normal;
axis square;
I want a figure like this . Square.
Any help will be greatly appriciated.
Thank you very much in advance!

Walter Roberson on 24 Aug 2022
Edited: Walter Roberson on 24 Aug 2022
You will need to create a calibration pattern and record it with some external camera, and create an undistortion matrix. You would draw into an array instead of on to the display, and then you would apply the undistortion matrix to it to arrive at the final image to display. The image would then pass through the distortion of your pc display and the distortion and undistortion would cancel out.
The computer vision toolbox contains tools for analyzing camera distortion that could be applied in reverse.
If this sounds as if I am blaming your pc display or your graphics hardware for not displaying correctly, then you have understood correctly.
Image Analyst on 24 Aug 2022
@MP Walter's answer doesn't sound "very rude" to me. He's saying that the distortion might be caused by your video adapter settings. Are they set to the "recommended" screen resolution settings? As far as I know the recommended settings are always for square pixels. If your recommended settings are 1980x1080 and you have it set for 1440x1080 then it may stretch the image so that something that would appear square with square pixel resolution setting will not appear square.
Walter Roberson on 24 Aug 2022
There are several different standard types of distortion for CRT displays, including pincushioning and bowing.
LCD and OLED and QLED displays are considerably less prone to some kinds of distortions, but they are not free of distortion, especially if viewed at angles.
Those are distortion at the physical display level. There is also potential distortion if the graphics card is sending incorrect or less-than-optimal information, due to settings or problems with the graphics driver or problems with the graphics card.
In the past I have used axis square on my iMac and measured the size of a data rectangle with digital calipers. On my system, the lengths of the two sides was equal to within round-off error.