geoshow cuts off grid data

5 ビュー (過去 30 日間)
Maarten
Maarten 2014 年 2 月 14 日
コメント済み: Jonas Damsbo 2018 年 10 月 18 日
Hello,
I have a global grid of data (nLat,nLon = 24,36) which I'm trying to map with the geoshow() function. However, it's cutting off several columns on the left and right side of the map. I've tried different ways of mapping as described in the help, but the same thing keeps happening.
Below a minimal example. What am I doing wrong? Should I use a different function?
Thanks & cheers,
lon = -5:10:355;
lat = -90:7.5:90;
[latM lonM] = meshgrat(lat,lon);
data = rand([24,36]);
figure
ax = axesm('MapProjection', 'eqdcylin','grid','on');
mlabel;plabel;
geoshow(latM,lonM,data,'DisplayType','texturemap')
  1 件のコメント
Jonas Damsbo
Jonas Damsbo 2018 年 10 月 18 日
Hi Maarten
How are you get coastlines on your map? :)

サインインしてコメントする。

採用された回答

Kelly Kearney
Kelly Kearney 2014 年 2 月 14 日
Unfortunately, all the mapping toolbox plotting functions clip data to the map frame. If part of a line segment, patch object, etc. overhangs the frame, then that graphics object is not plotted at all. Sometimes not noticeable, and other times, as in your case, very noticeable.
The only way around it (other than preprocessing your data, via maptrimp/l/s and upsampling of raster data) that I know of is to fiddle with the exact limits of the frame to match it up to the boundaries of your data.
It might help to rearrange your input data to the same order as it will be displayed. For example, you get less trimming if you sent your map limits to [0 360] (like your data) than [-180 180]:
lon = -5:10:355;
lat = -90:7.5:90;
[latM lonM] = meshgrat(lat,lon);
data = rand([24,36]);
subplot(2,1,1);
ax = axesm('MapProjection', 'eqdcylin','grid','on', ...
'frame', 'on');
mlabel;plabel;
geoshow(latM,lonM,data,'DisplayType','texturemap');
tightmap;
subplot(2,1,2);
ax = axesm('MapProjection', 'eqdcylin','grid','on', ...
'frame', 'on', 'maplonlimit', [0 360]);
mlabel;plabel;
geoshow(latM,lonM,data,'DisplayType','texturemap');
tightmap
  1 件のコメント
Maarten
Maarten 2014 年 2 月 16 日
Thanks, Kelly, that was helpful. I solved the problem by shifting the map limits by 1/2 of a longitude step so that they coincide with the edges of the of columns.
It turns out I have the same problem for the latitudes. Here this solution does not work because you cannot specificy map limits outside the [-90 90] range. So I simply omitted the top and bottom rows (which do not contain interesting information anyway) and shrunk the map with 1/2 a latitude step at the top and bottom.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by