To create the graph you described, you can use meshgrid to align your grid data with longitude and latitude, and m_contour to draw contours at regular intervals. Here’s a step-by-step outline of the process::
- Generate longitude and lattitude grids
lon_min = ...; % e.g., 100
lon_max = ...; % e.g., 110
lat_min = ...; % e.g., 20
lat_max = ...; % e.g., 30
lon = linspace(lon_min, lon_max, 300);
lat = linspace(lat_min, lat_max, 300);
[Lon, Lat] = meshgrid(lon, lat); % size(Lon) = [300, 300]
- Setup "m_map" projection
figure
m_proj('mercator', 'lon', [lon_min lon_max], 'lat', [lat_min lat_max]);
m_grid('box','fancy','tickdir','in');
hold on
- Draw evenly spaced contour lines
interval = 20;
min_val = floor(min(data(:))/interval)*interval;
max_val = ceil(max(data(:))/interval)*interval;
v = min_val:interval:max_val;
[~, h] = m_contour(Lon, Lat, data, v, 'k'); % 'k' for black lines
clabel(_, h); % Optional: Add contour labels
Refer to the following documentations to know more about the functions used: