import matrix into mapping toolbox? or just draw coastlines in fig
1 次查看(过去 30 天)
显示 更早的评论
Hi y'all,
I'm a longtime user of matlab but new to the mapping toolbox, and I've read through teh documentation but see little to no reference to regular matrices. I have the following data:
>> whos cummDose Name Size Bytes Class Attributes
cummDose 900x2159 15544800 double
>> whos lat Name Size Bytes Class Attributes
lat 1x1079 8632 double
>> whos lon Name Size Bytes Class Attributes
lon 1x2159 17272 double
*note I've trimmed lat to only be relevant for my anaylsis This results in the following figure:
I would really like to draw coastlines with something line the mapping toolbox, but does it deal with plain old matrices? Is there a relatively painless way to import this data given lat/lon and draw those coastlines? Is there a simpler or more logical way to do this? My sincerest apologies for the novice question, and thanks in advance for your input.
All the best, Kate
0 个评论
回答(2 个)
Chad Greene
2017-9-12
编辑:Chad Greene
2017-9-13
Hi Kate,
There are a couple of ways you can skin this cat. An easy and computationally efficient way to do it without the Mapping Toolbox is just treat longitudes like x values and latitudes like y values. Then use my borders function to draw national boundaries:
imagesc(lon,lat,cummDose)
borders('countries','nomappingtoolbox')
axis xy
will plot everything you want to plot in plain unprojected coordinates. Since you seem to have some missing data, you may wish to make it transparent with imagesc by
h = imagesc(lon,lat,cummDose);
set(h,'alphadata',isfinite(cummDose))
If you prefer to do this with the Mapping Toolbox, you'll lose some computational efficiency and it'll be harder to share your scripts with anyone who does not have the Mapping Toolbox, but you'll gain the nice map projections available via worldmap.
Your dataset is not huge, so computational efficiency won't be a big issue, but if you ever experience figure sluggishness, try doing it with imagesc instead of worldmap. The difference is imagesc plots an easy, predictable grid, whereas projecting to map coordinates or using pcolor lets the grid squeeze and stretch. That said, to do this with the Mapping Toolbox, start by initializing a map with worldmap, then use pcolorm, then add the landareas as follows:
worldmap('world')
pcolorm(lat,lon,cummDose)
geoshow('landareas.shp')
0 个评论
Cedric
2017-9-11
编辑:Cedric
2017-9-11
Hi Kate,
You will find an easy way to achieve what you want here: https://www.mathworks.com/help/map/create-a-world-map.html
Note that if you don't want to cope with PLOTM at this stage (*), you can just:
plot( coastlon, coastlat ) ;
Best,
Cedric
(*) There is a whole set of map-oriented tools and resources that comes with the Mapping toolbox. PLOTM, for example, needs an AXESM object to be present. You may have used gca to access the current AXES object previously, and in the "Mapping world" it is gcm. If you are interested in working with the Mapping toolbox, I'd say that it takes a full day full time (a bit painful in the beginning) for getting used to the main logic and resources.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!