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

40 views (last 30 days)
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
  8 Comments
Jan
Jan on 13 Mar 2019
@P_L: Please take into account, that I cannot read the code on your screen, if you do not post it here.
"Axesm - I can't get to project properly and display all the ticks- I have just been trying this just in 2D and world map doesn't dispaly anything evewn if I use pcolorm."
I cannot follow this description. Your code contains two calles of axesm, but they are commented - which one are you talkinh of.
"I will be using cellfun to plot data as well."
Why? Is this a part of the question?
"I initially tried plottinmg onto a map that I couldn't get to work for eveything"
Then please post the code and the error message, or a detailed description of the difference between your expectation and the results.
"Still not working" does not allow to give you any advice how to fix the code.

Sign in to comment.

Accepted Answer

Jan
Jan on 12 Mar 2019
Do you want to set the DataAspectRatio of the axes?

More Answers (0)

Categories

Find more on Geographic Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!