MATLAB: Change the aspect ratio of x,y to plot Longitude and Latitude correctly ( I have the conversion needed- need help implementing it)

aspect ratioconversionlatitudelongitudemapsplotscalesxy

Hi there,
I am wanting to change my x,y axis to reflect true longitude and latitude scales.
The conversion is: 1 degree of longitude (x-axis) is equal to 111cos(latitude). Latitude being the Y-axis. I need this in order to create a single scalebar rather than 2 seperate ones.
this is the code I have but I do not know how to implement it – any help would be much appreciated!
Many thanks!
load('x_data.mat')
load('y_data.mat')
load('z_data.mat')
h = pcolor(X,Y, Z);
shading interp
%% map personalising
xlabel('Longitude (deg, E)');
ylabel('Latitude (deg, N)')
axis equal
% set axis limits
xlim([30.3 30.45])
ylim([40.7 40.8])
hold on

Best Answer

Do you want to set the DataAspectRatio of the axes?