surfacem - how to show partial cells

13 views (last 30 days)
Fredrik
Fredrik on 25 Nov 2016
Answered: Fredrik on 29 Nov 2016
Hi,
If I do
A = rand(3,3);
lat = [46 46.1 46.2; 42 42.1 42.2; 38 38.1 38.2];
lon = [10 11 12; 10.2 11.2 12.2; 10.4 11.4 12.4];
clf; axesm('MapProjection','eqdconicstd','MapLatLimit',[37.9 46.3]);
surfacem(lat,lon,A);
I will get 4 cells. But if I change the MapLatLimits to [37.9 46.1]:
clf; axesm('MapProjection','eqdconicstd','MapLatLimit',[37.9 46.1]);
surfacem(lat,lon,A);
The top right cell is missing because it is not fully within the lat/lon limits. How can I show cells/values that are only partially within the lat/lon limits in a map plot using surfacem/pcolorm etc?
Thanks, Fredrik, using R2015b

Accepted Answer

Fredrik
Fredrik on 29 Nov 2016
The solution I went with was to find the corners of each grid cell and then do a fillm for each gridpoint separately in a nested loop. It took 1 hour to run the loops but the result is exactly what I was looking for.

More Answers (1)

KSSV
KSSV on 25 Nov 2016
A = rand(3,3);
lat = [46 46.1 46.2; 42 42.1 42.2; 38 38.1 38.2];
lon = [10 11 12; 10.2 11.2 12.2; 10.4 11.4 12.4];
clf; axesm('MapProjection','eqdconicstd',......
'MapLatLimit',[min(lat(:)) max(lat(:))],'MapLonLimit',[min(lon(:)) max(lon(:))]);
surfacem(lat,lon,A);
  5 Comments
KSSV
KSSV on 29 Nov 2016
If this is the case, you have to pick only sea related coordinates and use surfm. There must be an option in the tool box to plot only sea or only land etc.
Fredrik
Fredrik on 29 Nov 2016
surfacem and surfm give the same result, i.e. not the way I want it. Also, I want all grid points (land, sea, ... ) to be shown the same way. I just gave the blue cells as an example.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!