I have a 3 matrices x & y containing long and lat co-ordinates and 'z' a specific data value at those co-ordinates.
Using the following i can produce the map but none of the data held in z is appearing???
...
m_proj('lambert','long',[2 -6],'lat',[-49.9 56]);
m_coast('patch',[1 .9 .7]);
m_tbase('contourf',[x:y:z];
m_grid('box','fancy','tickdir','in');
( x, y and z are all the same size)
ANy help is greatly appreciated
How do i associate the values held in x and y with the Long and Lat values of the grid?
Any ideas??
If I take the m_map out of it
[Lat, Long] = meshgrid(linspace(min(x), max(x)), linspace(min(y), max(y)));
Grid = griddata(x, y, z, Lat, Long);
contourf(Lat, Long, Grid, 50);
I get what I'm after I'm then just unsure how to get this to sit on top of the m_map stuff so that it appears on the map...?
Use m_contourf, not m_tbase
m_contourf(Lat,Long,Grid,50)
Thank you for your reply...
Using the below code it sort of works however i was trying to get the contour to fill the land on the map as opposed to just sitting in almost a diamond shape on top of it:
clc
clear
x = xlsread('MAP','Sheet1','C4:C12');
y = xlsread('MAP','Sheet1','D4:D12');
z = xlsread('MAP','Sheet1','E4:E12');
m_proj('lambert','long',[2 -6],'lat',[49.9 55.5]);
[lat, long] = meshgrid(linspace(min(x), max(x)),linspace(min(y), max(y)));
TempGrid = griddata(x, y, z, lat, long);
m_contour(lat, long, TempGrid, 20);
m_coast('line');
m_grid;
colormap(flipud(gray));
At the moment the size of the contour plor is governed by:
[lat, long] = meshgrid(linspace(min(x), max(x)),linspace(min(y), max(y)));
I want it to be governed by the map itself so it colours in the map
Any ideas how m_map handles this, as in some of the examples (which i appreciate link to databases) the land is perfectly coloured through i believe the 'patch' command but i'm not able to get this to work either??
Yes, but you have specified
m_coast('line')
This specifies the coastline as a line.
Doh
Did you bother typing:
help m_coast
And after you typed it, did you bother reading what it said:
M_COAST('line', (standard line option,...,...) ) draws the
coastline
as a simple line.
M_COAST('patch' ( ,standard patch options,...,...) ) draws
the
coastline as a number of patches.
You have specify it as a patch, e.g.,
m_coast('patch',[0.808 1 0.808])
will make it a nice light green.
Yes i appreciate that but even with the above code, the data which i am trying to contour is not appearing as a patch on the map, it sits as part of a separate grid on top of the map???
Type:
help hold on
And once you've understood that, try plotting the coastline before
m_contour