Data cursor does not show lat and long values in a contourm plot (worldmap function)
Show older comments
I want to overlay a data set into North America. I used MATLAB's worldmap() function to get just North America and used plotm() to plot the coastline of North America from coast.mat(this file also comes with MATLAB). I then used contourm() to plot my data over the coast lines. The code below shows what I did.
hold on
h= worldmap('na');
c = load('coast.mat');
plotm(c.lat,c.long);
contourm(lat,long,value);
"lat" and "long" contain latitude and longitude and are of sizes,lets say 'm' and 'n'. "value" has the data to be plotted which is a matrix of size m x n. The data plots fine but the only problem is that when I use the data cursor, instead of seeing values used in plotting: latitude for "y", longitude for "x" and "value" for z I see really large numbers for x and y and always a 0 for z.
The return from
h=worldmap('na')
shows similar large values for XLimit and YLimit. I tried to change this to the coordinate limits but the graph basically disappeared with out any error.I also tried creating a custom data cursor but I could not get to accurately change the values to geo coordinates.
Any help would be appreciated!
Answers (1)
Chad Greene
on 27 Apr 2015
1 vote
4 Comments
Bipush Osti
on 27 Apr 2015
Chad Greene
on 27 Apr 2015
In what way does it not work?
Bipush Osti
on 28 Apr 2015
Chad Greene
on 28 Apr 2015
Edited: Chad Greene
on 28 Apr 2015
Strange! I'm afraid I don't understand that warning at all. Does this work for you?
hold on
h= worldmap('na');
c = load('coast.mat');
plotm(c.lat,c.long);
z = peaks(180);
[long,lat] = meshgrid(-179:0,89.5:-.5:0);
contourm(lat,long,z);
[lat_loc,lon_loc] = inputm(1);
t = textm(lat_loc,lon_loc,...
['(',num2str(lat_loc),'\circ N, ',num2str(lat_loc),'\circ S)'],...
'vert','middle','horiz','center');
Categories
Find more on MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!