MATLAB Answers

Add regions of statistical significance to a map plot

31 views (last 30 days)
mashtine on 12 Aug 2015
Commented: mortain on 3 Oct 2015
I am using the following to map out a trend in data over a region:
ax = worldmap(latlim, lonlim);
S = shaperead('landareas','UseGeoCoords',true);
surfacem(lat, lon, inpdata)
geoshow([S.Lat], [S.Lon],'Color','black');
This should be simple but I am not seeing fora with it. Is there any way to now add in a surfacem plot of a matrix holding p-values of the trends? I would like to simply add a cross where the corresponding cell in the p-value matrix is < 0.05.


Sign in to comment.

Accepted Answer

Chad Greene
Chad Greene on 29 Aug 2015
You'll find a few hatch filling functions on the File Exchange site. For example, the ones mentioned here.
Generally, to apply non-mapping toolbox plotting functions to maps, you'll need to do something like
[x,y] = mfwdtran(lat,lon);
and then you'd be able to use hatchfill as shown in the Pick-of-the-Week example.


Show 2 older comments
Chad Greene
Chad Greene on 22 Sep 2015
[Lon,Lat] = meshgrid(lon,lat);
[x,y] = mfwdtran(Lat,Lon);
mashtine on 23 Sep 2015
Thanks a lot Chad. That did the trick on the projection side of thing but now I do not think that findobj is finding any patches on my plot as hPatch1 returns a 0x0 GraphicsPlaceholder. I attached my script to see if you can make any sense as to why I am getting this error.
I am getting the error:
Index exceeds matrix dimensions.
Error in hatchfill (line 96)
hax = get(A(1),'parent');
and I believe that is the case because hPatch1 is empty as no patch handle was found.
You have been a big help thus far so thank you.
mortain on 3 Oct 2015
I am getting the same error after updating to Matlab 2015.
Have you found a fix for this problem?

Sign in to comment.

More Answers (0)

Sign in to answer this question.